Forum Discussion

Kevin_Werner's avatar
Kevin_Werner
New Contributor II
2 years ago

Automated process to disable users based on Inactivity Threshold / Remaining Allowed Inactivity

We worked with OneStream to set the Inactivity Threshold to 90 days but discovered inactive users are not automatically Disabled after 90 days - only flagged as 0 days of "Remaining Allowed Inactivity".  I'm assuming we could create a Business Rule or some other process that could query OneStream security data within the system to confirm users who meet the "Remaining Allowed Inactivity" = "0 Days" criteria.  Manual review could work as well but not preferred.

Any suggestions on how this could be automated in OneStream?

Thanks in advance.

  • BenStuart's avatar
    BenStuart
    New Contributor III

    Hi Kevin,


    We use something like this on an extender rule which we run from a data management job, which is on the task scheduler to run once a day.

    Case Is = ExtenderFunctionType.ExecuteDataMgmtBusinessRuleStep
    					
    ' Get Users
    Dim userList As List(Of UserSummaryInfo) = BRApi.Security.Admin.GetUsers(si)
    ' Loop through users
    For Each usr As UserSummaryInfo In userList
    
    	'Get UserName
    	Dim objUserInfo As UserInfo = BRApi.Security.Admin.GetUser(si,usr.ToString)
    	'Get Remaining Allowed Inactivty
    	Dim inactive As String = BRApi.Security.Admin.GetUserAndStatus(si,usr.ToString).LogonStatus.GetNumDaysOfRemainingAllowedInactivity()
    						
    	'If the user is currently enabled
    	If objUserInfo.User.IsEnabled = True Then
    		'If no remaining allowed inactivty
    		If inactive = "0" Then
    			'Disable user
    			objUserInfo.User.IsEnabled = False
    			'Save User
    			BRApi.Security.Admin.SaveUser(si, objUserInfo.User, False, Nothing, TriStateBool.Unknown)
    		End If
    	End If				
    Next

     

  • Kevin_Werner's avatar
    Kevin_Werner
    New Contributor II

    Thanks for the suggestion.  This code appears to provide the expected result.  We are doing some additional review but hope to deploy in our Production Environment soon.  Thanks for sharing!!