[英]Middleware For Users Roles and Permissions
I'm wanting to develop some middleware for my Laravel 5 application. 我想为Laravel 5应用程序开发一些中间件。 I have some criteria for this middleware that I need help thinking about and trying to help understand what could possibly be the best route to handle this tasks.
对于该中间件,我有一些标准,需要我考虑和尝试帮助理解什么可能是处理此任务的最佳途径。
I have multiple users. 我有多个用户。 And each user has ONE role.
每个用户都有一个角色。 Each role has permissions on what they are allowed to do AND I would like to have a way for user's to be able to override their roles permissions and have their specific permissions to them.
每个角色都具有对其被允许执行的操作的权限,并且我希望用户可以使用一种方法来覆盖其角色权限并对其具有特定的权限。
This way if I have John Doe who is a Basic User and normal basic users aren't allowed to create an article but I can make it to where in the database that John Doe can then I want to be able to to allow for that. 这样,如果我有作为基本用户的John Doe,并且不允许普通的基本用户创建文章,但是我可以将其放入数据库中John Doe可以的位置,那么我希望能够允许该操作。
I hope that is as much information as I needed to provide minus my current database schema which I'm about to provide. 我希望提供的信息量要少于我当前要提供的数据库模式所需的信息。
Table: users
Fields: id, username, email, role_id
Table: roles
Fields: id, role, description
Table: permissions
Fields: id, permission, description
Table: permission_role
Fields: id, permission_id, role_id
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.