#173663 - 2007-02-06 01:04 AM
if member of group and group b then
|
jeremyschubert
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
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
With EnumGroup() you can enumerate them. Or maybe you want to know
If InGroup("Group1") And InGroup("Group2")
;Do Stuff
EndIf
|
|
Top
|
|
|
|
#173671 - 2007-02-06 06:52 AM
Re: if member of group and group b then
[Re: Les]
|
jeremyschubert
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
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
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
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
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Like Les said there is no need for 'And':
If InGroup('Science','amth')
;do something
EndIf
|
|
Top
|
|
|
|
#173679 - 2007-02-06 03:10 PM
Re: if member of group and group b then
[Re: jeremyschubert]
|
Richard H.
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.
$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
|
|
|
|
#173683 - 2007-02-06 05:32 PM
Re: if member of group and group b then
[Re: Les]
|
Benny69
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.
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)
|
|
Top
|
|
|
|
#173697 - 2007-02-07 03:45 AM
Re: if member of group and group b then
[Re: Glenn Barnas]
|
jeremyschubert
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2375 anonymous users online.
|
|
|