At the end of every CRUD create/edit page, you will see the checkboxes for roles/permissions.
By default, our system is seeded with two roles: Admin and Simple user. Default permissions are the same, except the difference that simple user cannot edit other users.
For every CRUD, you can specify what actions are allowed for every role, see above.
There are five actions:
- Access: to see that CRUD menu item at all in sidebar
- Create: to see Add new button in the list
- Edit: to see Edit button in the table for every entry
-
View: to see View button in the table for every entry - Controller's method
show()
- Delete: to see Delete button in the table for every entry
Of course, permissions control not only what they see, but use Laravel Gates under the hood to restrict the actions.
You can add more Roles by going to User management
-> Roles
menu item.
How it works in generated code
It works differently depending on your membership plan of QuickAdminPanel.
In One Project or Developer plans, all permissions are generated into one file app/Providers/AuthServiceProvider.php as an array, which you can edit yourself after download:
// Auth gates for: Projects
Gate::define('project_access', function ($user) {
return in_array($user->role_id, [1, 2]);
});
Gate::define('project_create', function ($user) {
return in_array($user->role_id, [1]);
});
Gate::define('project_edit', function ($user) {
return in_array($user->role_id, [1]);
});
Gate::define('project_view', function ($user) {
return in_array($user->role_id, [1, 2]);
});
Gate::define('project_delete', function ($user) {
return in_array($user->role_id, [1]);
});
But you can't visually edit permissions, there's no menu item for that specifically.
Agency plan customers have much more flexibility - permissions are stored in the database, in DB tables permissions
and permission_role
, and there are menu items for adding/editing Permissions after download.
We don't use any packages for that (to avoid unnecessary dependencies), but it's pretty similar to the Spatie Laravel Permission package.