SqlAzManStorage.CheckAccess throw "Item Not Found" error

Sep 22, 2009 at 9:28 AM

Im new to NetSqlAzMan, just tried some simple to code to see if this thing work.

I defined an operation "Ops1" and a task "Task1". When I tried to call SqlAzManStorage.CheckAccess on Task1 it throw an "Item Not Found" error. But it works on "Ops1".
But if i call IAzManItem.CheckAccess on "Task1" it work. Anyone can explain this to me?

I have following code:

 string cs = @"Data Source=servername;Initial Catalog=NetSqlAzManStorage;User Id=user;Password=pwd";

 IAzManStorage storage = new SqlAzManStorage(cs);

 WindowsIdentity identity = WindowsIdentity.GetCurrent();

 Label1.Text = identity.Name;

 storage.OpenConnection();
 IAzManStore store = storage.GetStore("MyStore");
 IAzManApplication application = store.GetApplication("TestApp");
 IAzManItem operation1 = application.GetItem("Task1");
IAzManItem operation2 = application.GetItem("Ops1");
 //this one throw "Item Not Found" exception
 AuthorizationType authorization1 = storage.CheckAccess("MyStore", "TestApp", operation1.Name, identity, DateTime.Now, true);
 //all following code works
 AuthorizationType authorization2 = storage.CheckAccess("MyStore", "TestApp", operation2.Name, identity, DateTime.Now, true);
 AuthorizationType authorization3 = operation1.CheckAccess(identity, DateTime.Now);
 AuthorizationType authorization4 = operation2.CheckAccess(identity, DateTime.Now);


Thanks!
Jason
Coordinator
Sep 22, 2009 at 9:59 AM

Hi Jason,

the issue is on the CheckAccess lastparameter (OperationOnly)

//this one throw "Item Not Found" exception
 AuthorizationType authorization1 = storage.CheckAccess("MyStore", "TestApp", operation1.Name, identity, DateTime.Now, true);

Change it to false to allow check access on items different from Operations (Roles and/or Tasks):

AuthorizationType authorization1 = storage.CheckAccess("MyStore", "TestApp", operation1.Name, identity, DateTime.Now, false);

Regards,

Andrea.

__________________________________
Andrea Ferendeles
NetSqlAzMan Project Coordinator  
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com

Sep 22, 2009 at 10:18 AM

Oh..yes, thanks for your prompt reply!