简体   繁体   English

添加新权限时如何处理管理员/用户的用户权限?

[英]How to deal with user permissions for admin/users when adding new permissions?

I am creating a website where all users have different types of permissions.我正在创建一个所有用户都拥有不同类型权限的网站。

I am not doing role based permissions.我没有做基于角色的权限。

Users can join different groups and get different permissions for each group.用户可以加入不同的组,并为每个组获得不同的权限。

The part I am struggling with here is how to deal with the admin(group creator) permissions.我在这里苦苦挣扎的部分是如何处理管理员(组创建者)权限。

The admins permissions are a little different from regular users because admins always have access to every permission even when new permissions are added.管理员权限与普通用户略有不同,因为即使添加了新权限,管理员也始终可以访问每个权限。

While users have to be given the permission by an admin., an admin can give all of their permissions to a user except editing the admins permissions.虽然用户必须由管理员授予权限,但管理员可以将所有权限授予用户,但编辑管理员权限除外。

I imagine I can have a table where there are UsersId , PermissionId , Type(Admin/User) , GroupID .我想我可以有一个表,其中有UsersIdPermissionIdType(Admin/User)GroupID

There will only be 1 admin per group.每个组只有 1 名管理员。 But the part that seems asinine to me is if we (the application) were to add another permission capability.但是对我来说似乎很愚蠢的部分是如果我们(应用程序)要添加另一个权限功能。 We would have to query every UserID with type = Admin , and insert a record for that permission.我们必须使用type = Admin查询每个UserID ,并为该权限插入一条记录。 That seems horribly inefficient.这似乎非常低效。 Is there a better way I can do this?有没有更好的方法可以做到这一点?

Create a AdminUserId column on your Group table.在您的Group表上创建一个AdminUserId列。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM