简体   繁体   中英

Middleware For Users Roles and Permissions

I'm wanting to develop some middleware for my Laravel 5 application. 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.

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

Strongly recommend you to evaluate Zizaco's Enstrust L5 package. If you need something else or you want to code yourself this, then review the package code for guiadance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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