DESCRIPTION
This VBScript policy sample demonstrates how to add a newly created user to a predefined group, subject to approval
Note This code may use functions from the Active Roles Script Policy Best Practices. Please, follow the link to obtain instructions and code for those functions.
SCRIPT
'*********************************************************************************
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
' PLEASE CONTACT ONE IDENTITY PROFESSIONAL SERVICES.
'*********************************************************************************
Sub onPostCreate(Request)
If (Not IsObjectClassRequested("user", Request) Then Exit Sub
Dim objGroup
'----- bind to predefined group -----
Set objGroup = GetObject("EDMS://CN=Sales-London,OU=Sales,DC=foocompany,DC=com")
'----- add a newly created user to the group -----
objGroup.PutEx ADS_PROPERTY_APPEND, "member", DirObj.get("distinguishedName")
'---- put ARS control for approval ------
objGroup.Control ("AllowApproval", true) = "Confirm"
objGroup.Control ("OperationReason", true) = "This request was created automatically by ARS script policy"
objGroup.Control ("InheritInitiatorInfo", true) = "True"
'---- apply changes ------
objGroup.SetInfo
End Sub
'***** END OF CODE ***************************************************************