none
AzMan Authorization RRS feed

  • Question

  • Hi there,
    I hav created Authorization policy using AzMan(Authorization Manager).
    Assigned Active directory Groups&Users to the application roles created using Azman.
    I can able to check whether the provided User is belongs to the roles or not by the following code,

    //Code to create role.
    if (!Roles.RoleExists("TestRole"))
                {
                    Roles.CreateRole("TestRole");
                }

    //
    Code to check whether the provided user belongs to the role "TestRole".
    Roles.IsUserInRole("TestRole");

    but dont know how to get the respective operations and tasks for the provided user.
    Pls,let me know how to get it.

    Thanks&Regards,
    thiru.
    Monday, November 10, 2008 1:03 PM

All replies

  • Hi Thiru,

     

    Here is the sample code which might be helpful for you -

     

    public class RoleAttribute : Attribute

    {

    public RoleAttribute()

    {

    CreateRole = DefaultRole;

    }

    public RoleAttribute(Role role)

    {

    CreateRole = role;

    }

    public Role CreateRole

    {

    get { return this.createRole; }

    set { this.createRole = value; }

    }

    private Role createRole = 0;

    public const Role DefaultRole = Role.Administrator

    | Role.BackupOperator;

    }

    [RoleAttribute(RoleAttribute.DefaultRole)]

     

    RoleAttribute, instead of taking an array, would only take a single argument of flags (appropriately or-ed). If the underlying type of the Role enum is long or ulong, that gives you 64 different Roles.

     

    Hope above helps.

     

    Thursday, November 13, 2008 12:02 AM

  • Thanks Pooja,
    Im afraid,did u get my query r not.
    Let me elobrate my requirement .
    Im using Asp.net Role manager for
    the task of managing roles and performing role-based authorization in my appln.
    And Im using AuthorizationStoreRoleProvider to connect to the Azman policy store created in ADAM using AzMan(a part of MMC).

    In my .net application I know how to check the user's role using Role Manager API as follows,
    Role.IsUserExists("RoleName");

    or

    Role.GetRolesForUser("Username")

    but dono how to retrieve Corresponding operation or task for the Role of a provided user.
    Clearly ,I dont want to create or define role,tasks and operations using .net application ,as I did the same using AzMan.

    Thanks&Regards
    thiru.
    Saturday, November 15, 2008 7:03 AM