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 = 'LSLUsers'		; GOSUB LSLUsers
	
	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



* * * * * * *
LSLUsers:
* * * * * * *

SecGroup = Parms[1,@RM]

IF SecGroup = '' THEN RETURN

OPEN 'DICT.LSL_USER' TO DictVar THEN
	SearchString = 'TOOL_ID':@VM:ToolID:@FM
	Option = ''
	Flag = ''

	Btree.Extract(SearchString, 'TOOL_LOG', DictVar, TLKeys, Option, Flag)
	
	IF Get_Status(errCode) THEN
		ErrMsg(errCode)
		RETURN
	END
	
	FOR I = 1 TO COUNT(TLKeys,@VM) + (TLKeys NE '')
		TLKey = TLKeys<1,I>
		Result = INSERT(Result,1,1,0,TLKey)		;* List is sorted ascending - rearrange to descending
	NEXT I
END

RETURN


