I need to enable my admin user to change access permissions for users on the fly, such that they can create new Roles and add permissions to those Roles.
I want to be able to create an Authorize
attribute to stick above my controller class that I can add roles to from a database, so that I don't have to 'set' the roles during development, as in [Authorize(Roles="Role1, Role2")]
etc.
So something like [Authorize(Roles = GetListOfRoles()]
I found this question - ASP.NET MVC Authorize user with many roles which does something similar but maybe there's a way to change this such that it gets a list of permissions/roles from the db?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…