在腳本中將使用者新增至應用程式群組

在 Authorization Manager 中,應用程式群組是使用者和使用者群組的群組。 應用程式群組可以包含其他應用程式群組,因此使用者可以巢狀群組。 應用程式群組是由 IAzApplicationGroup 物件表示。

允許應用程式群組的成員執行工作或一組工作

  • 將該應用程式群組指派給包含這些工作的角色。

    角色是由 IAzRole 物件表示。

下列範例示範如何建立應用程式群組、將使用者新增為應用程式群組的成員,並將應用程式群組指派給現有的角色。 此範例假設在磁片磁碟機 C 的根目錄中有名為 MyStore.xml的現有 XML 原則存放區、此存放區包含名為 Expense 的應用程式,以及此應用程式包含名為 Expense Administrator 的角色。

'  Create the AzAuthorizationStore object.
Dim AzManStore
Set AzManStore = CreateObject("AzRoles.AzAuthorizationStore")

'  Initialize the authorization store.
AzManStore.Initialize 2, "msxml://C:\MyStore.xml"

'  Create an application object in the store.
Dim expenseApp
Set expenseApp= AzManStore.OpenApplication("Expense")

'  Create an application group object.
Dim appGroup
Set appGroup = expenseApp.CreateApplicationGroup("Approvers")

'  Add a member to the group.
'  Replace with valid domain and user name.
appGroup.AddMemberName("domain\\username")

'  Save information to the store.
appGroup.Submit

'  Open a role object.
Dim adminRole
Set adminRole = expenseApp.OpenRole("Expense Administrator")

'  Add the group to the role.
adminRole.AddAppMember("Approvers")

'  Save the information to the store.
adminRole.Submit