Updated: 1/08/2004; 9:33:33.
Hannes 'Shorty' Decorte's Radio Weblog
Learning .Net and the Experiences doing so


maandag 26 juli 2004

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    comment []

© Copyright 2004 Hannes 'Shorty' Decorte.
 
July 2004
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Jun   Aug



Other .Net Bloggers

Bart De Smet
Jan Tielens
Patrick Verbruggen
Patrick Tisseghem
Tom van de Kerkhof's Bloggings
Tom's Corner
Yves Hanoulle

Aggregated Feeds

Belgian .NET Bloggers