Question

        AzAuthorizationStoreClass authorizationStore = new AzAuthorizationStoreClass();
        authorizationStore.Initialize(0, ConfigurationManager.ConnectionStrings
                    ["StoreLocation"].ConnectionString, null);

        IAzApplication2 application = authorizationStore.OpenApplication2(ConfigurationManager.AppSettings["App"].ToString(), null);

Please let me know how to get operations, tasks, roles for an user.

Thanks

Was it helpful?

Solution

There's not a straightforward API for this. You'll have to roll your own.

For operations, you can just do an AccessCheck2 for each possible operation. Build a set of the allowed operations.

If you need to build tasks and role definitions, you'll have to compare the value of each IAzTask.Operations property to your built set of allowed operations. If your set of allowed operations is a superset of the Task/Role Definition Operations set, then the Task/Role Definition might be said to "belong" to the user.

If you have custom scopes in your policy store, you'll have to do this for each scope. If your application checks multiple scopes, then you'll have to take that into account when coming up with the final report of all operations/tasks/roles for a user.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top