Cool thing, but almost got me nuts (maybe should say even more nuts :-)).
Did the following:
AZROLESLib.AzAuthorizationStoreClass storeClass = new AZROLESLib.AzAuthorizationStoreClass();
//Open store storeClass.Initialize(0,@"msxml://C:ShortyAzManStoreAzManStoreOne.xml", null); //Get application AZROLESLib.IAzApplication app = storeClass.OpenApplication("Gymnastics",null);
//Get role AZROLESLib.IAzRole role = app.OpenRole("Admin", null); //Get tasks Array tasks = (Array)role.Tasks; //First Task string taskName = tasks.GetValue(0).ToString();
Guess what taskName contains => Admin????!!!!
No mather what I tried role.Tasks kept enumerating the application roles.
I examined the xml file containing the store and saw the following:
<AzTask Guid="8a827487-7fb7-4286-95c0-07387ddb5c21" Name="Admin" Description="" BizRuleImportedPath="" RoleDefinition="True"> </AzTask>
Apparently a role is a special kind of task. Should I be so lucky? Knowing this I tried the following:
//Open store AZROLESLib.AzAuthorizationStoreClass storeClass = new AZROLESLib.AzAuthorizationStoreClass(); storeClass.Initialize(0,@"msxml://C:ShortyAzManStoreAzManStoreOne.xml",null);
//Open application AZROLESLib.IAzApplication app = storeClass.OpenApplication("Gymnastics", null);
//Get the role as a task AZROLESLib.IAzTask task = app.OpenTask("Admin", null); //Get the tasks Array tasks = (Array)task.Tasks; //Get the first task string taskName = tasks.GetValue(0).ToString();
Guess what taskName contains => MyFirstTask :-))))))
Problem solved! Still this is a nasty bug, and apparently the MMC snap-in must implemented it with tasks instead of roles, cause it works fine in the UI.
8:27:55 PM
|