Unable to connect to ENS

Jul 14, 2009 at 9:55 AM
Edited Jul 14, 2009 at 10:00 AM

I have been trying to get the notifications of permissions changing in the sql policy store - database by .NetSqlAzMan MMC in my application, so that I can update my UserPermissionCache with the new security definitions.

I have been using the following code -

private void InitialiseAuthorization()

          { 

             try

            {

                        string cs = FetchApplicationStorePath();//       

 

                         m_storage = new SqlAzManStorage(cs); 

                         m_storage.OpenConnection();                       

                        m_cache =new UserPermissionCache(m_storage,StoreName,ApplicationName,WindowsIdentity.GetCurrent),true,true,null);       

                            m_storage.ENS.ApplicationPermissionGranted += ENS_ApplicationPermissionGranted; 

         } 

       catch(Exception e)

         {

                       MessageBox.Show("Error in accessing Sql AzMan Store." + e.Message);

          }

}

 private void ENS_ApplicationPermissionGranted(IAzManApplication application, string sqllogin, string role)

 

 {

                   m_cache =  new UserPermissionCache(m_storage,StoreName,ApplicationName,WindowsIdentity.GetCurrent(),true,true,null);

}

This event is not fired whenever I update the permissions related to my application from the MMC.

Please let me know if I am missing something here.

 

 

                     

Coordinator
Jul 14, 2009 at 10:22 AM

Hi,

Your application (something.exe) and the MMC Console (mmc.exe) are 2 different processes … so … 2 different App Domains … and cannot share ENS events.

ENS works only into the same App Domain (same process).


Regards,

Andrea.

__________________________________
Andrea Ferendeles
NetSqlAzMan - Project Coordinator

http://netsqlazman.codeplex.com

Jul 14, 2009 at 10:28 AM

Hi,

Thanks for instant reply!!

Is there a way by which I can get notification about the permissions changed, as I have to update my User Permission Cache on that.

Thanks,

Coordinator
Jul 14, 2009 at 10:33 AM

Yes … you can enable Information Logging on Database (MMC) … and create some custom trigger on the dbo.netsqlazman_log table.

Otherwise you can refresh the UserPermissionCache within regular intervals.

Another way could be using WCF Cache Service (instead of UserPermissionCache).


Regards,

Andrea.

__________________________________
Andrea Ferendeles
NetSqlAzMan - Project Coordinator

http://netsqlazman.codeplex.com