VBScript: ApprovalBack to VBScript: Approval
DESCRIPTION
This VBS script 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 ARS 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 MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
' PLEASE CONTACT QUEST PROFESSIONAL SERVICES.
'*********************************************************************************
'
' This code is published on the ActiveRoles Script Center:
' http://communities.quest.com/docs/DOC-9991
'
' This code may use functions from the ARS Script Policy Best Practices:
' http://communities.quest.com/docs/DOC-10016
'
' Please, follow the link to obtain instructions and code for those functions.
'*********************************************************************************
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 ***************************************************************
COMPATIBILITY
Script compatible with the following version(s): ARS 6.5 with the hotfix