laraditz / permission-plus
Laravel permission management for the lazy.
Installs: 29
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^8.0
- illuminate/support: ^8.0||^9.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-10-26 07:38:12 UTC
README
Laravel permission management for the lazy. The permission plus is a RRBAC (Role/Route Based Access Control) which is a method to restrict access control based on the application routes and roles. (Warning: This package is still in an early stage of development and may contain bugs).
Prerequisites
- PHP 8.0+
- Laravel v8.0+
- Spatie Laravel Permission V5
Installation
You can install the package via composer:
composer require laraditz/permission-plus
If you don't have one, you may create a new user account to be able to access the permission plus page. Use Laravel starter kits to get ur application up and running in no time.
Setup
Run the migration command to create the necessary database table.
php artisan migrate
Add HasPermissionPlus
trait to your User
model.
use Laraditz\PermissionPlus\Traits\HasPermissionPlus; class User extends Authenticatable { use HasPermissionPlus; }
(Optional) You can publish the config file via this command:
php artisan vendor:publish --provider="Laraditz\PermissionPlus\PermissionPlusServiceProvider" --tag="config"
Usage
After login, go to /permission-plus/permissions
to manage your permission and you will see below page. You may click Generate
button to generate all routes in your applications to start adding permissions.
Repeat the step if you add more routes.
Deploy to production
By default, all App\Models\Users
can access Permission Page locally. To allow them to access Permission Page in production, you must take a few extra steps to ensure that only the correct users have access to the page.
To set up your App\Models\User
to access Permission Page in non-local environments, you must overwrite the canAccessPermissionPlus
method.
public function canAccessPermissionPlus(): bool { // example return str_ends_with($this->email, '@yourdomain.com') && $this->hasVerifiedEmail(); }
To Do
- Add search
- Add documentation
- Add test
- Permission for resource owner
- Auto-detect available routes
- Make a more user-friendly UI
- Optimize layout for mobile view
- Add permission for individual user
- Refactor code
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email raditzfarhan@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.