Custom authorization for multiple roles

Apr 23, 2013 at 7:15 AM
Hi,

For custom authorization there is IsEditable method which is applicable only for one role.

public bool IsEditable(IPrincipal principal, Company target, string memberName)
    {

        return principal.IsInRole("AccountManager");  

    }
But I want that IsEditable method will be applicable for multiple roles as AccountManager,Manager etc.

What I have to do? Please give solution.

Thanks,
Elma.
Coordinator
Apr 23, 2013 at 8:38 AM
Just write something like this:
        var roles = new[] { "AccountManager", "CustomerService", "Admin" }; //etc
        return roles.Any(x => principal.IsInRole(x));
Apr 23, 2013 at 9:03 AM
Ok, Thanks Richard.