#189905 - 2008-09-26 07:06 PM
Map network drives according to user groups
|
BMartynowicz
Just in Town
Registered: 2008-09-18
Posts: 3
|
Yesterday the head of the IT Department here was trying to add a network drive to be mapped in the kix script (I'm not even really all that firmiliar with it, it was in place when I started here 3 months ago) hes also not knowledgable in kix language. The problem we run across now is it seems like its only entering the one IF statement for all users. Being new to this I have no idea what I'm supposed to do to fix it. I've had C/C++ and Java programming experience and this is a head scratcher. Hopefully its just something basic. I did some skimming of the forum and didn't see anything that could help me all that much. A response would be really greatly appreciated.
Heres a code snippet:
;;; students and default shares
SELECT
case INGROUP("students")
$icsstudentprefix=LEFT(@USERID,2)
SELECT
case $icsstudentprefix="s-"
$x=gci_mapdrive("U","\\ICS08\"+@USERID+$hide)
$x=gci_mapdrive("V","\\ICS04\student")
$x=gci_mapdrive("w","\\ICS04\icsstudent")
case 1
;for non ics student-teacher logons
$x=gci_mapdrive("U","\\ICS02\"+@USERID+$hide)
; $x=gci_mapdrive("U","\\ICS04\"+@USERID+$hide)
$x=gci_mapdrive("V","\\ICS04\student")
$x=gci_mapdrive("w","\\ICS04\icsstudent")
$x=gci_mapdrive("S","\\ICS08\SAM2003")
ENDSELECT
case 1
; for non students
; $x=gci_mapdrive("U","\\ICS02\"+@USERID+$hide)
;ENDSELECT
;TC Students SAM2003 Drive
;IF INGROUP("TCStudents")
; $x=gci_mapdrive("S","\\ICS08\SAM2003")
;ENDIF
;;; Applications ;;;
; note G and X are used more than once ;
IF INGROUP("pds census users")
$x=gci_mapdrive("F","\\ICS02\apps"+$hide)
$x=gci_mapdrive("G","\\ICS02\data"+$hide)
ENDIF
IF INGROUP("Administrators")
$x=gci_mapdrive("R","\\ICS02\techdept"+$hide)
ENDIF
IF INGROUP("TC ALL")
; $x=gci_mapdrive("G","\\ICS02\gradequick")
; $x=gci_mapdrive("X","\\ICS02\adminplus")
; $x=gci_mapdrive("T","\\ICS02\TCFaculty")
ENDIF
IF INGROUP("Librarians")
$x=gci_mapdrive("L","\\ICS02\Library")
ENDIF
IF INGROUP("Liturgy")
$x=gci_mapdrive("M","\\ICS02\Liturgy"+$hide)
ENDIF
IF INGROUP("PeachTree")
$x=gci_mapdrive("P","\\ICS02\Peachtree"+$hide)
ENDIF
IF INGROUP("ParishSoftUsers")
$x=gci_mapdrive("S","\\ICS02\parishsoft")
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS02\HR"+$hide)
ENDIF
IF INGROUP("Admin Plus")
$x=gci_mapdrive("X","\\ICS02\adminplus")
ENDIF
;;; Directors ;;;
;IF INGROUP("directors")
; $x=gci_mapdrive("W","\\server\directors")
;ENDIF
$gci_deptletter="INIT"
;;; Tech Admin ;;;
;IF INGROUP("techadmin")
; $x=gci_mapdrive("T","\\server\users")
; $x=gci_mapdrive("V","\\server\shared_areas")
; $gci_deptletter="V"
;ENDIF
;;; Multiple Departments ;;;
FUNCTION gci_nextdeptletter()
SELECT
case $gci_deptletter="INIT"
$gci_deptletter="V"
case $gci_deptletter="V"
$gci_deptletter="W"
case $gci_deptletter="W"
; $gci_deptletter="X"
$gci_deptletter="*"
case $gci_deptletter="X"
$gci_deptletter="*"
; $gci_deptletter="Y"
case 1
$gci_deptletter="*"
ENDSELECT
$gci_nextdeptletter=$gci_deptletter
$X = WRITELINE(1,"GCI next letter for multiple departments " + $gci_deptletter + @CRLF)
EndFunction
;;; Department ;;;
IF INGROUP("ALumni Staff")
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS02\Alumni"+$hide)
ENDIF
;IF INGROUP("TC All")
; $x=gci_mapdrive(gci_nextdeptletter(),"\\ICS02\TC"+$hide)
;ENDIF
IF INGROUP("MIT")
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS02\mit"+$hide)
ENDIF
IF INGROUP("Telephone Administrators")
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS02\Telecom"+$hide)
ENDIF
IF INGROUP("Parish Office Staff")
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS02\ParishOffice"+$hide)
ENDIF
IF INGROUP("Accountants")
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS02\Accountants"+$hide)
ENDIF
IF INGROUP("ICS Principal")
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS02\icsfrontoffice"+$hide)
ENDIF
IF INGROUP("ICS Staff")
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS02\icsfrontoffice"+$hide)
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS08\ICS Students"+$hide)
ENDIF
IF INGROUP("ICS ALL")
FOR $grade = 1 to 8 STEP 1
$gradelevel="ICS Team Grade "+CSTR($grade)
$X = WRITELINE(1,"GCI ICS student-teacher mappings " + $gradelevel + @CRLF)
IF INGROUP($gradelevel)
$x=gci_mapdrive(gci_nextdeptletter(),"\\ICS08\"+$gradelevel+$hide)
ENDIF
NEXT
ENDIF
|
|
Top
|
|
|
|
#189907 - 2008-09-26 07:45 PM
Re: Map network drives according to user groups
[Re: Gargoyle]
|
BMartynowicz
Just in Town
Registered: 2008-09-18
Posts: 3
|
Heres the Function:
FUNCTION gci_mapdrive ($letter, $share)
IF $letter<>"*"
$letter=$letter+":"
USE $letter /DELETE
IF @ERROR<>0
$logprintline="ERROR Deleting existing mapping " + @ERROR + " / " + @SERROR + " input is " + $letter
ELSE
$logprintline="Success Deleting existing mapping " + @RESULT + " input is " + $letter
ENDIF
$X = WRITELINE(1,"GCI " + $logprintline + @CRLF)
ENDIF
USE $letter $share
IF @ERROR<>0
$logprintline="ERROR New mapping " + @ERROR + " / " + @SERROR + " input is " + $letter + " " + $share
ELSE
$logprintline="success New mapping " + @RESULT + " input is " + $letter + " " + $share
ENDIF
$gci_mapdrive=$logprintline
$X = WRITELINE(1,"GCI " + $logprintline + @CRLF)
? "Mapping : input is " + $letter + " " + $share
EndFunction
What I mean for all users, is anyone that logs into our domain is getting the same mapped network drives the ones in this part of the script:
SELECT
case INGROUP("students")
$icsstudentprefix=LEFT(@USERID,2)
SELECT
case $icsstudentprefix="s-"
$x=gci_mapdrive("U","\\ICS08\"+@USERID+$hide)
$x=gci_mapdrive("V","\\ICS04\student")
$x=gci_mapdrive("w","\\ICS04\icsstudent")
case 1
;for non ics student-teacher logons
$x=gci_mapdrive("U","\\ICS02\"+@USERID+$hide)
; $x=gci_mapdrive("U","\\ICS04\"+@USERID+$hide)
$x=gci_mapdrive("V","\\ICS04\student")
$x=gci_mapdrive("w","\\ICS04\icsstudent")
$x=gci_mapdrive("S","\\ICS08\SAM2003")
ENDSELECT
I'm not quite sure how to check the debugging on it, I haven't learned that yet
Edited by BMartynowicz (2008-09-26 07:54 PM)
|
|
Top
|
|
|
|
#189914 - 2008-09-27 05:14 PM
Re: Map network drives according to user groups
[Re: BMartynowicz]
|
Gargoyle
MM club member
   
Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
|
Replace your select statement with this, and it should give you some information on the screen.
SELECT
case INGROUP("students")
@UserID +" was found to be in the students group"?
$icsstudentprefix=LEFT(@USERID,2)
"Student Prefix is " + $icsstudentprefix?
SELECT
case $icsstudentprefix="s-"
"Student Prefix matched s-"?
$x=gci_mapdrive("U","\\ICS08\"+@USERID+$hide)
$x=gci_mapdrive("V","\\ICS04\student")
$x=gci_mapdrive("w","\\ICS04\icsstudent")
case 1
"Student Prefix did not match s-"?
;for non ics student-teacher logons
$x=gci_mapdrive("U","\\ICS02\"+@USERID+$hide)
; $x=gci_mapdrive("U","\\ICS04\"+@USERID+$hide)
$x=gci_mapdrive("V","\\ICS04\student")
$x=gci_mapdrive("w","\\ICS04\icsstudent")
$x=gci_mapdrive("S","\\ICS08\SAM2003")
ENDSELECT
case 1
@UserID +" Did not match group Students"?
; for non students
; $x=gci_mapdrive("U","\\ICS02\"+@USERID+$hide)
;ENDSELECT
_________________________
Today is the tomorrow you worried about yesterday.
|
|
Top
|
|
|
|
#189934 - 2008-09-29 02:57 PM
Re: Map network drives according to user groups
[Re: BradV]
|
BMartynowicz
Just in Town
Registered: 2008-09-18
Posts: 3
|
Awesome that was it Brad thanks alot. Also thanks gargoyle for the debugging advice.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 774 anonymous users online.
|
|
|