Custom authorization for multiple roles

Apr 23, 2013 at 8:15 AM

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.

Apr 23, 2013 at 9: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 10:03 AM
Ok, Thanks Richard.