views:

180

answers:

1

Hello, I'd like to authorize users to perform specific actions within my controllers. I've found the ASP.NET tutorial which explains how to allow individual users to perform specific actions but can this be extended to security groups? For example, would everyone belonging to the "domain\group" security group have access to the GetSecrets action if the code looked like this:

[Authorize(Users="domain\group")]
public ActionResult GetSecrets()
{ return View(); }

If not, how would I do this?

+4  A: 

You want to use the Roles property. Note that this can be a comma-separated list of roles.

 [Authorize(Roles=@"domain\group")]
tvanfosson
+1 Amd you can place the above code at the class level to lock down the entire class and not just a sinfle action.
griegs
OK, so spolling and typing accuracy was never my thing!
griegs
Excellent. That makes since. Thank you!
sdr
@sdr -- since you're new, the way the system works is you vote up answers that are helpful using the arrows next to the vote count on the left. The best answer should get accepted by clicking the check mark below the vote count. You can only accept one answer.
tvanfosson