Page 1 of 1 1
Topic Options
#173663 - 2007-02-06 01:04 AM if member of group and group b then
jeremyschubert Offline
Getting the hang of it

Registered: 2005-09-17
Posts: 89
Is there a command I could use that would let me find out if one user is a member of two global groups? Would that be a UDF or some sort of syntax like if member of group a and group b then map this drive?
Thanks
_________________________
---
Bishop Grandin Technology Department
'Either we're on time, or we're late'

Top
#173665 - 2007-02-06 01:20 AM Re: if member of group and group b then [Re: jeremyschubert]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
With EnumGroup() you can enumerate them.
Or maybe you want to know
 Code:
If InGroup("Group1") And InGroup("Group2")
	;Do Stuff
EndIf

Top
#173669 - 2007-02-06 02:26 AM Re: if member of group and group b then [Re: Witto]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
No need for AND. InGroup() supports multiple parms. RTFM
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#173671 - 2007-02-06 06:52 AM Re: if member of group and group b then [Re: Les]
jeremyschubert Offline
Getting the hang of it

Registered: 2005-09-17
Posts: 89
Thanks guys. I just logged in again cause I realized I hadn't explained myself well. In our school, teachers are assigned a departmental drive based on group membership. So the math teachers S: drive is math$, while the science teachers get science$ and the English get English$, etc. In the past there have only been a few 'cross over' teachers who teach in two departments. So I have made a special global group for them. GG-SciandMath and GG-EnglishandHistory group for example. Those teachers would get a S drive for one department and a T drive for another. But now we're getting so many 'cross over' teachers, that making so many global groups seems crazy. So I'm looking for a way to say"

if you are in one department global group, map that drive.
if you are in two departments, figure out which departments they are and map a S and T drive
(I determine the department global groups but downtown also adds people to other global groups.)

Does what I'm saying make sense?

Jeremy
_________________________
---
Bishop Grandin Technology Department
'Either we're on time, or we're late'

Top
#173672 - 2007-02-06 09:14 AM Re: if member of group and group b then [Re: jeremyschubert]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
 Code:
If InGroup("Group1")
	Use "S:" "\\Server\Share1"
EndIf
If InGroup("Group2")
	Use "T:" "\\Server\Share2"
EndIf

Top
#173673 - 2007-02-06 01:53 PM Re: if member of group and group b then [Re: Witto]
jeremyschubert Offline
Getting the hang of it

Registered: 2005-09-17
Posts: 89
Thanks againt. That way though, I'm going to have to list a lot of permutations. For example

If ingroup ("math")...map the s drive
and
If ingroup ("science") and ("amth" map the s and t drive.

because the user may be in the math group and or the science group or another group.

I guess what I'm asking is, how could I code these instructions:

1. Look at the groups the user is a member of
2. Discover if the are a member of any of the following groups
-English, Math, Science, Modern Lanugages, Special Ed, Gym, Computers, Social Studies...
3. If they are a member of 1 of those groups, map a connection to that group's department files under the S: drive.
4. But if they are a member of 2 of those groups, map a connection to the first group's department files under the S drive and the next group's files under the T drive.
_________________________
---
Bishop Grandin Technology Department
'Either we're on time, or we're late'

Top
#173674 - 2007-02-06 02:32 PM Re: if member of group and group b then [Re: jeremyschubert]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Like Les said there is no need for 'And':
 Code:
If InGroup('Science','amth')
  ;do something
EndIf
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#173679 - 2007-02-06 03:10 PM Re: if member of group and group b then [Re: jeremyschubert]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Here is one way to do it. I've assumed that the group and share name are the same.
 Code:
$asGroups=Split("English,Math,Science,Modern Lanugages,Special Ed,Gym,Computers,Social Studies",",")
$sDrivesToUse="S:T:"
$sServer="MyFileServer"
 
For $sGroup in $asGroups
	If InGroup($sGroup)
		If $sDrivesToUse=""
			"ERROR: Sorry, not got any more drive letters left!"+@CRLF
		Else
			Use Left($sDrivesToUse,2) "\\"+$sServer+"\"+$sGroup
			$sDrivesToUse=SubStr($sDrivesToUse,3)
		EndIf
	EndIf
Loop

Top
#173682 - 2007-02-06 04:54 PM Re: if member of group and group b then [Re: Benny69]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Be careful about omitting the *Mode* parm, the default is OR, not AND.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#173683 - 2007-02-06 05:32 PM Re: if member of group and group b then [Re: Les]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Thanks Les, I did forget:
0 = InGroup checks for membership of one of the groups in the list (default).
1 = InGroup checks for membership of all of the groups in the list.

 Code:
If InGroup('Science','amth',1)
  ;do something
EndIf

If you do omit the *mode* parm it will default to 0.


Edited by Benny69 (2007-02-06 05:34 PM)
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#173687 - 2007-02-06 10:04 PM Re: if member of group and group b then [Re: jeremyschubert]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
The pre-built login script available from my web site does something much like this.

You can create resource records with priority values, so if someone matches more than one resource record, the one with the highest priority will apply. You basically define multiple resource records with decreasing member lists and increasing priorities.

You might want to tinker with it instead of trying to create complex code logic.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#173697 - 2007-02-07 03:45 AM Re: if member of group and group b then [Re: Glenn Barnas]
jeremyschubert Offline
Getting the hang of it

Registered: 2005-09-17
Posts: 89
Thanks to everyone. I now have a great starting point. I'll let you know how it goes in a week or so.
Jeremy
_________________________
---
Bishop Grandin Technology Department
'Either we're on time, or we're late'

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2175 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.066 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org