I'm currently trying to find out if you can add a Gate Fascade to a Policy or if there's a better way to handle my situation.
I have a list of users with each having ONE role and each role can have MANY permissions. All of this is stored in my database with the correct relationships established in my models.
I am trying to show or not show a delete icon based on whether a user can delete another user in my HTML list of users.
Example:
Lets say user1 has a role of 3 which is a site-admin. Site admins have the permission to delete users, however they are NOT able to delete other users who have the same role as them or a role higher than theirs.
When user1 accesses the /users uri they are shown the HTML table of users in the database and as the last table column are the actions that can be performed on the row for that user row. The available action icons are edit and delete. For the delete icon I want a policy to be ran to make sure than the authenicated user can delete users first but also pass the current row's user object and see if the user has the same role id or higher in which case it will NOT display that icon.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TYK39E
via IFTTT
Aucun commentaire:
Enregistrer un commentaire