开发者

Azman to get role,operations, tasks of an user

        AzAuthorizationStoreClass authorizationStore = new AzAuthorizationStoreClass();
        authorizationStore.Initialize(0, ConfigurationManager.ConnectionStrings
                    ["StoreLocation"].Connec开发者_运维问答tionString, null);

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

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

Thanks


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜