Reputation: 96
i want to authorize all action under adminController. how can i do that. i have a database with Roles and User. 1. Administrator 2. Member
i want only Administrators can access to all action in adminController.
Upvotes: 0
Views: 988
Reputation: 31416
If I follow what you are asking, I've done this to restrict access to the SiteAdminController:
[Authorize(Roles = "Site Admin")]
public class SiteAdminController : BaseController
That restricts access to the actions of my SiteAdminController
to users in that role.
Upvotes: 1
Reputation: 1935
[Authorize(Roles = "Administrator")]
public class controller() {
}
Upvotes: 1