added LSL2 stored procedures
This commit is contained in:
125
LSL2/STPROC/OBJ_SEC_GROUPS.txt
Normal file
125
LSL2/STPROC/OBJ_SEC_GROUPS.txt
Normal file
@ -0,0 +1,125 @@
|
||||
COMPILE FUNCTION obj_Sec_Groups(Method,Parms)
|
||||
/*
|
||||
Methods for SEC_GROUP table
|
||||
2/27/2012 JCH - Initial Coding
|
||||
Properties:
|
||||
Methods:
|
||||
LSLUsers() ;* Returns all users
|
||||
*/
|
||||
|
||||
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Dialog_Box
|
||||
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, Send_Dyn, Btree.Extract, ErrMsg
|
||||
DECLARE SUBROUTINE obj_Notes, Send_Info
|
||||
|
||||
$INSERT LSL_USERS_EQUATES
|
||||
$INSERT SEC_GROUPS_EQUATES
|
||||
$INSERT MSG_EQUATES
|
||||
|
||||
ErrTitle = 'Error in Stored Procedure "obj_Sec_Group"'
|
||||
ErrorMsg = ''
|
||||
|
||||
IF NOT(ASSIGNED(Method)) THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine'
|
||||
IF NOT(ASSIGNED(Parms)) THEN Parms = ''
|
||||
|
||||
IF ErrorMsg NE '' THEN
|
||||
Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
|
||||
RETURN ''
|
||||
END
|
||||
|
||||
Result = ''
|
||||
|
||||
BEGIN CASE
|
||||
CASE Method = 'AddUser' ; GOSUB AddUser
|
||||
CASE Method = 'RemoveUser' ; GOSUB RemoveUser
|
||||
CASE 1
|
||||
ErrorMsg = 'Unknown Method ':QUOTE(Method):' passed to routine.'
|
||||
END CASE
|
||||
|
||||
IF ErrorMsg NE '' THEN
|
||||
Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
|
||||
RETURN ''
|
||||
END
|
||||
|
||||
RETURN Result
|
||||
|
||||
|
||||
* * * * * * *
|
||||
AddUser:
|
||||
* * * * * * *
|
||||
|
||||
User = Parms[1,@RM]
|
||||
SecGroups = Parms[COL2()+1,@RM]
|
||||
|
||||
IF User = '' THEN ErrorMsg = 'Null parameter "User" passed to routine. (':Method:')'
|
||||
IF SecGroups = '' THEN ErrorMsg = 'Null parameter "SecGroups" passed to routine. (':Method:')'
|
||||
|
||||
IF ErrorMsg NE '' THEN RETURN
|
||||
|
||||
GroupCnt = COUNT(SecGroups,@VM) + (SecGroups NE '')
|
||||
|
||||
|
||||
FOR I = 1 TO GroupCnt
|
||||
SecGroup = SecGroups<1,I>
|
||||
otParms = 'SEC_GROUPS':@RM:SecGroup
|
||||
GroupRec = obj_Tables('ReadRec',otParms)
|
||||
|
||||
IF Get_Status(errCode) THEN
|
||||
RETURN
|
||||
END
|
||||
|
||||
LOCATE User IN GroupRec<SEC_GROUPS_USER$> BY 'AL' USING @VM SETTING Pos THEN
|
||||
obj_Tables('UnlockRec',otParms)
|
||||
END ELSE
|
||||
|
||||
GroupRec = INSERT(GroupRec,SEC_GROUPS_USER$,Pos,0,User)
|
||||
|
||||
otParms = FieldStore(OtParms,@RM,4,0,GroupRec) ;* Put record in 4th field of OtParms
|
||||
obj_Tables('WriteRec',otParms)
|
||||
|
||||
END
|
||||
NEXT I
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
RemoveUser:
|
||||
* * * * * * *
|
||||
|
||||
User = Parms[1,@RM]
|
||||
SecGroups = Parms[COL2()+1,@RM]
|
||||
|
||||
IF User = '' THEN ErrorMsg = 'Null parameter "User" passed to routine. (':Method:')'
|
||||
IF SecGroups = '' THEN ErrorMsg = 'Null parameter "SecGroups" passed to routine. (':Method:')'
|
||||
|
||||
IF ErrorMsg NE '' THEN RETURN
|
||||
|
||||
GroupCnt = COUNT(SecGroups,@VM) + (SecGroups NE '')
|
||||
|
||||
|
||||
FOR I = 1 TO GroupCnt
|
||||
SecGroup = SecGroups<1,I>
|
||||
otParms = 'SEC_GROUPS':@RM:SecGroup
|
||||
GroupRec = obj_Tables('ReadRec',otParms)
|
||||
|
||||
IF Get_Status(errCode) THEN
|
||||
RETURN
|
||||
END
|
||||
|
||||
LOCATE User IN GroupRec<SEC_GROUPS_USER$> BY 'AL' USING @VM SETTING Pos THEN
|
||||
|
||||
GroupRec = DELETE(GroupRec,SEC_GROUPS_USER$,Pos,0)
|
||||
|
||||
otParms = FieldStore(OtParms,@RM,4,0,GroupRec) ;* Put record in 4th field of OtParms
|
||||
obj_Tables('WriteRec',otParms)
|
||||
|
||||
END ELSE
|
||||
obj_Tables('UnlockRec',otParms)
|
||||
END
|
||||
NEXT I
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user