스크립트의 역할로 작업 그룹화
권한 부여 관리자에서 역할은 사용자 범주와 해당 사용자가 수행할 권한이 있는 작업을 나타냅니다. 작업은 그룹화되고 역할 정의에 할당됩니다. 이 정의는 IsRoleDefinition 속성이 True설정된 IAzTask 개체로 표시됩니다. 그런 다음 역할 정의를 IAzRole 개체에 할당할 수 있으며 사용자 또는 사용자 그룹이 해당 개체에 할당됩니다. 작업 및 역할에 대한 자세한 내용은 역할참조하세요.
다음 예제에서는 역할 정의에 작업을 할당하고, 역할 개체를 만들고, 역할 정의를 역할 개체에 할당하는 방법을 보여 줍니다. 이 예제에서는 C 드라이브의 루트 디렉터리에 MyStore.xml 명명된 기존 XML 정책 저장소가 있고, 이 저장소에 Expense라는 애플리케이션이 포함되어 있으며, 이 애플리케이션에 지출 제출 및 비용 승인이라는 작업이 포함되어 있다고 가정합니다.
' 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 a task object to act as a role definition.
Dim roleTask
Set roleTask = expenseApp.CreateTask("Expense Admin")
' Set the IsRoleDefinition property of roleTask to True.
roleTask.IsRoleDefinition = True
' Add two tasks to the role definition.
roleTask.AddTask CStr("Submit Expense")
roleTask.AddTask CStr("Approve Expense")
' Save the role definition to the store.
roleTask.Submit
' Create a role object.
Dim role1
Set role1 = expenseApp.CreateRole("Expense Administrator")
' Add the role definition to the role object.
role1.AddTask(roleTask.Name)
' Save the role object to the store.
role1.Submit