UserPermissionCache usage

Topics: General Topic
May 10, 2012 at 6:03 PM

Hi Andrea,

Can you please let me know how does one use the userPermissionCache to cache all the user access and then access that data?

I know it is done with this code:

IAzManStorage storage = new SqlAzManStorage("data source=.;Initial Catalog=NetSqlAzManStorage;Integrated Security = SSPI;");

NetSqlAzMan.Cache.UserPermissionCache userPermissionCache = new NetSqlAzMan.Cache.UserPermissionCache(storage, "My Store", "My Application", WindowsIdentity.GetCurrent(), true, true);

AuthorizationType auth = userPermissionCache.CheckAccess("My Operation", DateTime.Now);

But what happens next?

May 11, 2012 at 1:15 PM

Then … something like this:

if (auth==AuthorizationType.Allow || auth==AuthorizationType.AllowWithDelegation)

{

//User is authorized … do something

}

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

Da: silviudc [email removed]
Inviato: giovedì 10 maggio 2012 19:04
A: Andrea Ferendeles
Oggetto: UserPermissionCache usage [netsqlazman:355333]

From: silviudc

Hi Andrea,

Can you please let me know how does one use the userPermissionCache to cache all the user access and then access that data?

I know it is done with this code:

 
IAzManStorage storage = new SqlAzManStorage("data source=.;Initial Catalog=NetSqlAzManStorage;Integrated Security = SSPI;");
 
NetSqlAzMan.Cache.UserPermissionCache userPermissionCache = new NetSqlAzMan.Cache.UserPermissionCache(storage, "My Store", "My Application", WindowsIdentity.GetCurrent(), true, true);
 
AuthorizationType auth = userPermissionCache.CheckAccess("My Operation", DateTime.Now);
 

But what happens next?

May 11, 2012 at 4:44 PM

Yes that works just fine.

Thank you.

switch(auth) is also handy.