Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在MVC5中排序角色层次结构以访问授权页面?_C#_Asp.net Mvc_Authorization - Fatal编程技术网

C# 如何在MVC5中排序角色层次结构以访问授权页面?

C# 如何在MVC5中排序角色层次结构以访问授权页面?,c#,asp.net-mvc,authorization,C#,Asp.net Mvc,Authorization,如何在MVC5项目中排序角色层次结构以访问授权页面 我在MSSQL数据库角色表中有多个角色(管理员、版主、编辑、注册) 我的问题是,如果需要控制器访问权限,如何使用管理员、版主或编辑器访问用户 [CustomAuthorization(Roles = "Registered")] 现在,我只能通过为用户选择的角色进行访问 或者我必须为每个人添加这样的角色 [CustomAuthorization(Roles = "Administrator, Moderator,

如何在MVC5项目中排序角色层次结构以访问授权页面

我在MSSQL数据库角色表中有多个角色(管理员、版主、编辑、注册)

我的问题是,如果需要控制器访问权限,如何使用管理员、版主或编辑器访问用户

[CustomAuthorization(Roles = "Registered")]
现在,我只能通过为用户选择的角色进行访问

或者我必须为每个人添加这样的角色

[CustomAuthorization(Roles = "Administrator, Moderator, Editor, Registered")]

还有别的解决办法吗?

是的,你说得对。这方面的文章很多