We've written a simple AzMan wrapper class in .NET which uses the AZROLESLib COM interop library to access AzMan.
It all works fine, except when we make changes to the underlying XML store, those changes do not get reflected in subsequent calls to the AZROLESLib.
Our code looks something like this:
At the class level we store a reference to the authorisation store:
IAzAuthorizationStore AuthorisationStore = new AzAuthorizationStoreClass();
During construction of our class we initialise the store:
AuthorisationStore.Initialize(0, XML_STORE_PATH)
The follow code gets executed whenever we make a request for roles:
AuthorisationStore.UpdateCache();
var application = AuthorisationStore.OpenApplication(APPNAME);
// we do a query here and return the results
However, the call to UpdateCache seems to do nothing at all. I've tried using CloseApplication after every call but it simply throws an exception: "The request is not supported. (Exception from HRESULT: 0x80070032)". If I new up an AuthorisationStore on every call, I get an Access Denied exception instead (I assume because the old Authorisation Store still has a handle to the file?).
How can I get the authorisation store to refresh itself on every call?
Thanks!
I'm closing this as I've noticed that this is now mysteriously working; the call to
is the key one. I have no idea why it wasn't working before, but it must have been something that I was doing wrong...