of_loadsecurity


pfcapsrv.pbl   >   pfc_n_cst_security   >   of_loadsecurity   

Full name pfc_n_cst_security.of_loadsecurity
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_loadsecurity(string)

Name Datatype
No Data

Name Datatype
li_idx integer
li_rc integer
ls_object string

protected function integer of_loadsecurity (string as_object);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_LoadSecurity
//
//	Access:  protected
//
//	Arguments : 
//	as_object	name of object to load security for
//
//	Returns:  Integer
//				 1 if there is security on the object
//				 0 if there is not security
//				-1 for error
//
//	Description:  Reads in the security inrofmatino about the window for the current user
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   	Initial version
// 5.0.03	force sorting after retrieve
//	6.0 		Add precache code.  Changed return type from boolean to integer
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

integer  li_rc, li_idx
string 	ls_object

// check arguments
If len(as_object) < 0 or isnull(as_object) then Return -1

ls_object = lower(as_object)

// filter the datastore for rows matching this object name
is_currfilter = "window='" + ls_object + "'"
If ids_items.SetFilter(is_currfilter) <> 1 Then Return -1
If ids_items.Filter() <> 1 Then Return -1

// if we have rows then we have loaded security for this object before
il_numberofrows = ids_items.RowCount()
If il_numberofrows = -1 Then
	Return -1
End If

// Check if items are already cached or is object has been retrieved before.  
//	If so, no need to re-retrieve them
If Not ib_precache Then 
	// first time for this object
	If (il_numberofrows = 0) Then  
		il_numberofrows = ids_items.Retrieve(is_app, ls_object, is_userID )
		If il_numberofrows = -1 Then
			Return -1
		End If
		
		// read in the setting for all the groups the the user belongs to - appending to the datastore
		For li_idx = 1 To ii_numgroups 
			li_rc = ids_items.Retrieve(is_app, ls_object, ids_groups.object.group_name[li_idx] )
			If li_rc = -1 Then
				Return -1
			Else
				// Resort to force ordering
				ids_items.sort() 
				il_numberofrows += li_rc
			End If
		Next
	End If
End If

If il_numberofrows > 0 Then
	Return 1
Else
	Return 0
End If

end function

     
Name Owner
pfc_n_cst_security.of_setsecurity pfc_n_cst_security
pfc_n_cst_security.of_setsecurity pfc_n_cst_security
pfc_n_cst_security.of_setsecurity pfc_n_cst_security
pfc_n_cst_security.of_setcontrolarray pfc_n_cst_security

     
Name Owner
datastore.filter datastore
datastore.rowcount datastore
datastore.setfilter datastore
datastore.sort datastore
systemfunctions.isnull systemfunctions
systemfunctions.len systemfunctions
systemfunctions.lower systemfunctions

     
Full name
No Data

     
Name Scope
No Data