Page 1 of 1 1
Topic Options
#118189 - 2004-04-18 11:38 AM Enumgroup
Mattps Offline
Fresh Scripter

Registered: 2004-04-18
Posts: 12
I have only been using KIXtart for a short while and have been playing with the enumgroup function. Can any one tell me what order enumgroup returns groups from a users account details. e.g. return groups alphabetically or by SID.

Thanks.

Top
#118190 - 2004-04-18 02:09 PM Re: Enumgroup
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why do you need to know this? Why should it matter? There are sorting UDFs if you really need the groups alphabetically.
_________________________
There are two types of vessels, submarines and targets.

Top
#118191 - 2004-04-18 03:41 PM Re: Enumgroup
Mattps Offline
Fresh Scripter

Registered: 2004-04-18
Posts: 12
I need to know what order they are enumerated in because I am trying to map 4 drive letters to user specific folders and one on the folders needs to be mapped to S: depending on the group.
Is there relationship in the order the groups are listed in AD U&C and when enumerated?

Top
#118192 - 2004-04-18 04:18 PM Re: Enumgroup
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Then why don't you use INGROUP()? That would be much faster than enumerating all groups a user is member of. You might want to also show us the code you have so we can assist you more effectively.
_________________________
There are two types of vessels, submarines and targets.

Top
#118193 - 2004-04-18 05:19 PM Re: Enumgroup
Mattps Offline
Fresh Scripter

Registered: 2004-04-18
Posts: 12
Okay here goes...
Currently we reorganising out folder structure on our file srevers so that the follow convention is ahered to:

Shared folder
|
|-Organisation 1
| |-Department 1
| | |-Departmental folders
| |-Department 2
| |-Departmental folders
|-Organisation 2
|-Department 1
| |-Departmental folders
|-Department 2
|-Departmental folders

Department global groups have been created to apply to each resource (can't use DLG's as still in Mixed mode) so that each department folder can only be accessed by their repsective departments. The standard convention is that shared folder mappings use the S: drive.

However, and this is were I get a headache...

One particular organisation historically accessed multiple deparmental folders. So we have allocated 4 drive letters for use with shared folders S:, N:, O:, and T: - I swear I didn't pick these!

One of our techs wrote a script so that should a user be a member of multiple groups it would map more than one drive. But the script was just a list of Ingroup statements that had no structure and users would end up 2 or drive mappings to the same locations because one person in the department accessed more than one share.
So I have written the below script which works on my test network. However and this is where I am stumped. Because historically the default shared drives where mapped to the s: I want to carry this on. When my script runs it enumerated the groups that a use is in and then assigns one of the available drive letters whether it be S:, N:, O: or T:. If there was a way to get KIX to enumerate a users group membership in the same order as shown in AD U&C then I could put the primary froup at the top of the membership list and this would following in the script enumeration and would be assigned as S:. I know this sounds complicated, here is what I have come up with so far:

CLS
DIM $Index
DIM $DriveIndex
DIM $NextDrive
Dim $Temp
GLOBAL $Group[40]
$Index = 0
DO
$Group[$Index]=0
$Index=$Index+1
UNTIL $Index=40
$Index=0
DO
$Group[$Index] = ENUMGROUP($Index)
$Index = $Index + 1
UNTIL Len($Group[$Index]) = 0
$DriveIndex = 0
$Index = 0
DO
SELECT
CASE $DriveIndex = "0"
$NextDrive = "S:"
CASE $DriveIndex = "1"
$NextDrive = "N:"
CASE $DriveIndex = "2"
$NextDrive = "O:"
CASE $DriveIndex = "3"
$NextDrive = "T:"
ENDSELECT
$Temp = $Group[$Index]
IF $Temp = "HOME\gRPCTDept1" USE $NextDrive "\\hmdc01\shared\rpct\Department 1" $DriveIndex = $DriveIndex + 1 ENDIF
IF $Temp = "HOME\gRPCTDept2" USE $NextDrive "\\hmdc01\shared\rpct\Department 2" $DriveIndex = $DriveIndex + 1 ENDIF
IF $Temp = "Home\gRPCTDept3" USE $NextDrive "\\hmdc01\shared\rpct\Department 3" $DriveIndex = $DriveIndex + 1 ENDIF
$Index = $Index + 1
UNTIL ($DriveIndex = 4) OR ($Index = 40) OR ($Temp = 0)

Top
#118194 - 2004-04-18 05:31 PM Re: Enumgroup
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Still a combination of INGROUP() functiosn should suffice. Also, you really want to standardize drive letters and their associated shares. Finally, the UDF Forum contains drive mapping UDFs that map a share to the next available drive letter in a provided list. You could also create a .INI file that contains a list of shares, their associated drive letters, and the groups that are allowed to map to it. Example scripts for this have also already been posted on this BBS.
_________________________
There are two types of vessels, submarines and targets.

Top
#118195 - 2004-04-18 06:10 PM Re: Enumgroup
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Musical drive letters are a really bad idea. Not only does it cause confusion but also broken links. Why not just map a single share closer to the root?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#118196 - 2004-04-18 06:20 PM Re: Enumgroup
burnsc Offline
Starting to like KiXtart

Registered: 2004-04-14
Posts: 171
There is another aspect to this too. It really adds highly to 'support costs' as well. Add this to the fact if you ever reach a point where you are 'pushing' or 'pulling' application images it makes you not be able to trust your own drive mappings. It is best (as Les said in less words) to group directories to as few shares as possible and use pathing in the applications. At least this has been my experience.
Top
#118197 - 2004-04-19 09:58 AM Re: Enumgroup
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Have to agree.

I have a tree structure which maps Organisation, Region and office/branch.

The business requirement was that users only see "their" information, because it was deemed that they were too stupid to be able to navigate a three tier folder tree.

This means that local staff mapped to the office share, regional managers to the region share so that they can see all of their depots, and Divisional manager mapped to the top level.

This has been an administrative nightmare, and I'm doing stealth changes to move everyone to the top of the tree and use application path settings to access files at the right level.

Much simpler, much less hassle and sooo much easier when the branches get re-organised.

So, stick to a single share, use file/directory permissions to control access and set the paths for applications on the fly at login.

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
1 registered (Allen) and 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.061 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

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