Assume we have two groups “Admins” and “Users”. Admins are able to use any operation available in the service but the users can only use some of them.
Should I add the “Admins” group to every single operation or if I just write it on top of the class will do the trick?
Thanks.
Multiple RequiresRole attributes are combined with an AND while multiple roles passed to a single attribute are OR’d. In your case, you’ll want to OR the attributes (“User” or “Admin”) so you’ll have to apply “Admin” to every single method.
// “Admin” && “User”, equivalent to using a class attribute for “Admin”
[RequiresRole(“Admin”), RequiresRole(“User”)]
// “Admin” || “User”
[RequiresRole(“Admin”, “User”)]