z1haze / laravel-acl
This package is abandoned and no longer maintained.
No replacement package was suggested.
A simple to use ACL for Laravel 5.3
v0.4.0
2017-02-10 13:39 UTC
Requires
- php: >=7.0
- illuminate/support: 5.3.*|5.4.*
Requires (Dev)
- doctrine/dbal: ^2.5
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~5.0
README
Laravel-ACL is a Laravel 5.3|5.4 level based access control package with explicit negating capabilities that makes for easy management for hierarchical permissions systems.
Table of Contents
Requirements
- This package requires PHP 7+
Getting Started
Require the package via composer.
$ composer require z1haze/laravel-acl
or
{
"require": {
"z1haze/laravel-acl": "0.4.*"
}
}
Register the service provider in config/app.php
.
'providers' => [ ... z1haze\Acl\Providers\AclServiceProvider::class, ... ],
Publish and configure the configuration file before migrating.
php artisan vendor:publish --provider="z1haze\Acl\Providers\AclServiceProvider"
Migrate the database
php artisan migrate
This package is designed for the models to be extended with your own models, which can be setup in the config.
Also ensure that make the newly added
level_id
field fillable on your user model.
Register the middleware in app/Http/Kernel.php
.
protected $routeMiddleware = [ ... 'laravel-acl' => \z1haze\Acl\Middleware\HasPermission::class ... ],
Add the following HasAcl
trait to your user
model.
use \z1haze\Acl\Traits\HasAcl class User extends Model implements AuthenticatableContract, CanResetPasswordContract { use Authenticatable, CanResetPassword, HasAcl; }
Documentation
For more detailed information, read the Wiki.
Roadmap
Current TODO's
- Add directives for blade or find a way to extend the existing laravel ones
- Add middlware support for route resources
Changelog
February 6, 2017
- Updated
getAllPermissions
to return only permissions inherited and assigned even if the level/user has the master permission. Having the master permission itself returned infers a user has access to every permission anyway.
February 3, 2017
- Added
assignLevel
for the permission model - Added
clearLevel
for the permission model - Added
addUser
,addUsers
for the permission model - Added
removeUser
,removeUsers
for the permission model
February 1, 2017
- Added
syncPermissions(array)
for both users and levels - Added
getNegatedPermissions()
for the user model - Added
isHigherThan()
,isLowerThan()
, andisEqualTo()
for comparing ranks for users and levels - Added exceptions for permissions/levels that return no results