I have 3 models [User, Role, UserRole]
Use {ID [PK], Name, Email, Password, .....}
Role {ID [PK], Name, Description, .......}
UserRole {UserID [FK], RoleID [FK]}
Consider role-based authorization on a controller using the [Authorize] attribute, indicating that the user must be in the administrator role to access any controller action in the class
[Authorize(Roles = "Administrator")] public class PageController : Controller {
This is beautiful, I need
Is there a way to assign my role collection to the [Authorize] attribute? eg
I will select the assigned roles from the Recorded User and save it in the list. Can I assign this list to the [Authorize] attribute? something like the following:
[Authorize(Roles = MyDynamicallyLoadedList)] public class PageController : Controller {
source share