使用不同的用户类型(角色)分别管理数据库记录
我目前正在寻求逻辑帮助。我在数据库中的角色很少,它们是按层次顺序排列的。当具有最低角色的用户删除记录时,不应为具有上述角色的用户删除该记录。
我应该如何创建我的数据库表,以及如何创建这样的系统?
我没有故意定义记录。记录可以是任何表。每当用户登录系统并删除某些记录时,这些记录必须仍然对具有更高权限的用户可见
I am asking a logical help currently. I have few roles in database, they are in hierarchical order. When the user with lowest role deletes the record it should not be deleted for the user with the role above.
How should I create my database table, and how can I create such system?
I have not defined records on purpose. Records can be of any table. Whenever a user logs in to the system, and deletes some records, those records must still be visible by the user with higher
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有给我们什么可做的,但在较高的层次上,我认为这样的结构会起作用:
当用户“删除”一条记录时,您应该只删除 UserRecords 表中的相应条目。这将防止一个用户删除其他用户的记录。他们只能删除与该记录的关系。
You have given us very little to go off of, but at a high level I think a structure like this would work:
When a user "deletes" a record you should just remove the corresponding entry in the UserRecords table. This will prevent one user from deleting records for other users. They would only be able to delete their relationship to that record.