Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.4] User Access to Abilities #19143

Merged
merged 1 commit into from
May 11, 2017
Merged

[5.4] User Access to Abilities #19143

merged 1 commit into from
May 11, 2017

Conversation

browner12
Copy link
Contributor

Description

Currently the abilities are stored in the Gate class as a protected property. this PR adds a simple getter to return the defined abilities.

the router has an identical method to access all the routes

Use Case

Currently if you set up some kind of Role/Permission ACL, you possibly store the Permissions and the Roles in the database. Chances are, the developer is still the only person who can CRUD the Permissions, because they still need to be used in authorization in the code. Then the layman are able to create the Roles and apply Permissions to them, and assign Roles to Users.

This would allow the programmer to skip storing the Permissions in the database, and instead simply define them on the Gate class. Then when Permissions are being applied to the Roles, we could use this method to access all the Permissions/abilities available.


If you don't need to have a web UI to define Permissions, the database becomes an unnecessary extra repository, because (often) the ServiceProvider is simply pulling the Permissions out of the database, and registering them into the Gate (the new repository). This PR will help eliminate that redundancy for projects that don't need the Permissions in a web UI.


I am currently testing out Spatie's awesome permissions package and that's where this idea came from.

@taylorotwell taylorotwell merged commit 9dd222c into laravel:5.4 May 11, 2017
@browner12 browner12 deleted the get-abilities branch May 11, 2017 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants