Associate users with roles and permissions

Overview

Social Card of Laravel Permission

Associate users with permissions and roles

Sponsor

If you want to quickly add authentication and authorization to Laravel projects, feel free to check Auth0's Laravel SDK and free plan at https://auth0.com/developers.

Latest Version on Packagist Total Downloads

Documentation, Installation, and Usage Instructions

See the DOCUMENTATION for detailed installation and usage instructions.

What It Does

This package allows you to manage user permissions and roles in a database.

Once installed you can do stuff like this:

// Adding permissions to a user
$user->givePermissionTo('edit articles');

// Adding permissions via a role
$user->assignRole('writer');

$role->givePermissionTo('edit articles');

Because all permissions will be registered on Laravel's gate, you can check if a user has a permission with Laravel's default can function:

$user->can('edit articles');

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

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 [email protected] instead of using the issue tracker.

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards on our company website.

Credits

This package is heavily based on Jeffrey Way's awesome Laracasts lessons on permissions and roles. His original code can be found in this repo on GitHub.

Special thanks to Alex Vanderbist who greatly helped with v2, and to Chris Brown for his longtime support helping us maintain the package.

And a special thanks to Caneco for the logo

Alternatives

License

The MIT License (MIT). Please see License File for more information.

Comments
  • Add model/permissions caching

    Add model/permissions caching

    This adds substantial speed increases by caching the associations between models and permissions. Part of the changes focus on the PermissionRegistar, specifically caching for getPermissions(), thanks to @klincheg for these changes.

    The rest is focussed on caching calls to HasPermissionTo() in HasPermissions.php.

    The association is cached under a compound key comprised of the package key, the model and the permission: spatie.permission.cache.App.Models.User.12.Spatie.Permission.Models.Permissions.view-dashboard

    These values are also used as tags: spatie.permission.cache, App.Models.User.12, Spatie.Permission.Models.Permissions.view-dashboard (if tags are not supported then the package continues as before, as they are essential to this functionality)

    As we are still using the package cache key, then the already existing cache-busting should not need to be updated to account for these changes. However, the usage of the model and the permissions in the tags allow for future addition of model specific, or permission specific cache-busting, helping prevent the stampeding herd effect that larger applications may experience each time a permission or role is updated.

    Performance tests involved seeding a database with 250 users, who were assigned between 2 - 4 roles, which were assigned between 30 - 500 permissions. Then each permission for each user was tested:

    $this->users->each(function (User $user) {
        $user->getAllPermissions()->each(function (Permission $permission) use ($user) {
            $this->assertTrue($user->can($permission->name));
        });
    });
    

    I went through different variations of the above, some including non-assigned permissions, etc.

    These changes increase the speed of the checks from several minutes down to 4 - 20 seconds (approx 32000 assertions in a couple of seconds in some tests). And the database calls went from 1800+ to 0.

    Things to note/get feedback on are:

    • Is the current cache busting effective enough for these changes? I reviewed the tests and ran through some real-world examples and had no issues, but a second opinion would be great.
    • The changes to the config could be breaking
    • The naming of checkHasPermissionTo() inside HasPermissions could be confused with the newly added method checkPermissionTo()
    • Clutter. I'm concious this has added a fair bit of new methods and checks, and I don't want to clutter up the package.

    Closes #732 Fixes #759 Fixes #789

    opened by fullstackfool 41
  • Next major release -- Features/Requests for v3

    Next major release -- Features/Requests for v3

    It feels like the last couple of months a lot of issues were related to the multi-guard functionality introduced in v2. Apart from that there have been some vague caching issues as well. Time to do something about that in v3 of the package.

    The multi-guard issue

    Supporting multiple guards has added a lot of complexity to the package and made it feel quite "heavy". The multi-guard functionality is definitely a selling point for this package but it also seems to confuse some users that are new to the framework and haven't learned about guards yet. Not to mention the countless times a misconfiguration in auth.php causes the wrong guard to be used.

    Some possible solutions:

    • completely dropping support for guards - as @drbyte and I discussed at Laracon removing all support for multiple guards would make the package a lot easier to maintain, simpler and lighter.
    • my personal favourite: drop guard support but keep Permissions and Roles polymorphic relations. This means any model can have roles and permissions but there's no extra functionality related to guards.
    • maintaining two branches: one with- and one without support for guards.

    Caching issue

    There's no interface or CLI tool that comes with the package to create and manage roles/permissions. This means a lot of users revert to editing the DB to manage permissions causing the cache to be rendered invalid. Even though it's well documented this seems to be an issue that keeps coming back. Maybe caching should be limited to a single request lifecycle by default and configurable for anyone that needs more anything else?


    Any thoughts on these two issues or suggestions for other features for v3 of the package are very welcome!

    revisit for future version 
    opened by AlexVanderbist 41
  • $guarded value on Role/Permission class causes failure in latest laravel 7.x and 6.x

    $guarded value on Role/Permission class causes failure in latest laravel 7.x and 6.x

    With regards the latest laravel update that is documented here: Security Release: Laravel 6.18.35, 7.24.0

    And also the code change happened here in the 6.x branch https://github.com/laravel/framework/pull/33777

    These two updates have broken the functionality when you try to perform a with() query on the Roles model.

    For example I have the code:

    Role::orderBy('type')
        ->withCount('users')
        ->paginate();
    

    This gives the error:

    PHP Notice:  Undefined index: guard_name in app/vendor/spatie/laravel-permission/src/Models/Role.php on line 62
    TypeError: Argument 1 passed to getModelForGuard() must be of the type string, null given, called in app/vendor/spatie/laravel-permission/src/Models/Role.php on line 62
    

    It seems the solution is to just set the $guarded property to [] in the model classes.

    If someone is extending the class this is easy to fix, but unfortunately it isn't very clear immediately what error caused this.

    If it is alright with the maintainers I don't mind making the change to the model files to the code that will make it functional.

    System Info:

    Laravel: 6.18.35 PHP: 7.3.8 Permissions: 3.13

    opened by ReeceM 36
  • [Bug? 4.3.0] Checking Permission via can() return PermissionDoesNotExists

    [Bug? 4.3.0] Checking Permission via can() return PermissionDoesNotExists

    Hi. First, thanks for this great packages. I've been using this packages since version 1.

    I have user with Role 'System Administrator', and this roles has permission named 'dashboard', 'logs', etc. When I'm checking the user's permission via can, it throws Spatie\Permission\Exceptions\PermissionDoesNotExist.

    • spatie/laravel-permission package version: 4.3.0
    • illuminate/framework package: v8.55.0

    PHP version: 8.0.7 Database version: MySQL 8.0.25

    This is not happening prior to version 4.3.0. We have traced this issue, and found that getPermissions on Spatie\Permission\PermissionRegistrar is the culprit here.

    This is how we resolve this problem:

            $permissions = $this->permissions->$method(static function ($permission) use ($params) {
                foreach ($params as $attr => $value) {
                    if ($permission->getAttribute($attr) == $value) {
                        return true;
                    }
                }
    
                return false;
            });
    

    I think the return value are swapped? If I swap the 'true' and 'false' value like above, it behaves normally, and I only get PermissionDoesNotExists exception only when I'm supplying it with wrong / invalid permission.

    Thanks

    opened by shadowbane 35
  • PermissionDoesNotExist while Permission actually does exist.

    PermissionDoesNotExist while Permission actually does exist.

    Hello,

    I am trying to implement permissions in my pages to hide menu items, by example. Currently, I am using this:

    @if(auth()->user()->hasPermissionTo('view_admin_top_menu'))
    //content
    @endif
    

    But it keeps returning the PermissionDoesNotExist exception while I am very sure the permission is in the database. Also, @hasrole() works... so it is very weird to me.

    Thanks.

    opened by bjarn 34
  • guard_name also as a function

    guard_name also as a function

    Could it be possible to make $guard_name a property and a static function in the same way Nova does it with 'group' and 'name'? So we can use config('nova.guard')? I'm using a 'web' guard for normal users and a 'back' guard for admin users.

    enhancement help wanted revisit for future version 
    opened by gerardnll 32
  • There is no permission named `edit articles` for guard `web`.

    There is no permission named `edit articles` for guard `web`.

    I am having issue when seeding the roles and permissions. I even copy their sample on database seeding here https://github.com/spatie/laravel-permission#database-seeding. I even clear and removed cache before seeding and still I get that error as you can see on this screenshot https://www.screencast.com/t/PAMOsZjS

    Anyone could help?

    Thank you.

    opened by jacktyler2318 29
  • ErrorException  : Trying to access array offset on value of type null. On fresh laravel installation.

    ErrorException : Trying to access array offset on value of type null. On fresh laravel installation.

    I can't install the package on my recent laravel project. It works fine on the previous ones. Here is the error I get

    `composer require spatie/laravel-permission Using version ^3.6 for spatie/laravel-permission ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 1 install, 0 updates, 1 removal

    • Removing spatie/laravel-view-components (1.2.0)
    • Installing spatie/laravel-permission (3.6.0): Loading from cache Writing lock file Generating optimized autoload files

    Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

    ErrorException : Trying to access array offset on value of type null

    at /home/abdellah/Documents/PROJECTS/Bank/vendor/spatie/laravel-permission/src/PermissionServiceProvider.php:61 57| protected function registerModelBindings() 58| { 59| $config = $this->app->config['permission.models']; 60|

    61| $this->app->bind(PermissionContract::class, $config['permission']); 62| $this->app->bind(RoleContract::class, $config['role']); 63| } 64| 65| protected function registerBladeExtensions()

    Exception trace:

    1 Illuminate\Foundation\Bootstrap\HandleExceptions::handleError() /home/abdellah/Documents/PROJECTS/Bank/vendor/spatie/laravel-permission/src/PermissionServiceProvider.php:61

    2 Spatie\Permission\PermissionServiceProvider::registerModelBindings() /home/abdellah/Documents/PROJECTS/Bank/vendor/spatie/laravel-permission/src/PermissionServiceProvider.php:36

    Please use the argument -v to see more details. Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

    Installation failed, reverting ./composer.json to its original content.`

    support 
    opened by abdellahrk 28
  • Question: Multi Tenant

    Question: Multi Tenant

    In a SaaS kind of app, I want the Roles to be tenant specific, meaning:

    Roles for App X | Roles for App Y ------------ | ------------- Owner | Superintendent Worker| All mighty Maintenance| Superman

    Its not only a matter of naming, each role has different permissions, and App X can't see App Y roles and vice versa. Also there can be an infinite number of apps...

    Any suggestion for achieving this? Maybe using guards? Maybe adding a tenant column to the tables? Thanks.

    revisit for future version 
    opened by jonagoldman 27
  • [Proposal] Role Hierarchy Level (integer)

    [Proposal] Role Hierarchy Level (integer)

    Hey all,

    thanks for this awesome package - i really like it as it is quite easy to use. Recently, i stumbled upon a problem, which i thought i could share with you - this might be a contribution for your package.

    Problem

    In my application i have Teams (a User can be in multiple Teams) and Projects (a Project can have multiple Teams). Furthermore, a Team can have a specific Role within a Project. Therefore, one User can have multiple Roles within a Project.

    For now, let us call these Roles Owner, Manager and Member (as they already imply some kind of Hierarchy: Owner > Manager > Member.

    I would like to retrieve the highest (i.e., the role with the most access rights) Role for one specific User within a Project.

    Idea

    I thought it may be possible to enhance the Role table and add an additional level (int, default 0) field to the database. This field would act as some kind of hierarchy.

    In the given example, one could just define Owner (10) > Manager (5) > Member (1). Note that the numbers indicate the level.

    When retrieving all Roles for the User within a Project we would just need to sort by level and we're already set up!

    Furthermore, this idea could be enhanced in order to provide some additional functions to restrict access not only by Role or Permission but also by Level. Think about a method like this hasAtLeastRoleLevel(int level) to check, if the level of the User is higher than - therefore he has access..

    What do you think about this feature? Best

    enhancement revisit for future version 
    opened by johannesschobel 25
  • Question: User with diferent Roles and Companies

    Question: User with diferent Roles and Companies

    Hi! I need to implement in a system where a user can be from different companies with different rules for each of them. Ex: User X - Company A - Admin User X - Company B - Manager Remembering that my system is not Multi Tenancy. It's possible with this package?

    support 
    opened by georgecpacheco 24
  • "message": "Undefined array key \"id\"", "exception": "ErrorException", "file": "MYAPP/vendor/spatie/laravel-permission/src/PermissionRegistrar.php"

    PHP Version: 8.1.10 (for both CLI and Apache) Laravel version : 8.1

    I started to have this issue after I merged my branch to another branch, while the user of that branch does not have this issue.

    He updated php to 8.1 which I also did after merging with his branch but this issue is persisting and not letting me get into the api in browser or postman. The full response is attached.

    response.json.zip

    opened by inimist 0
  • Delegate permission filter to another method

    Delegate permission filter to another method

    This could help with third party customization of the package

    It is the same code, only i did move it to his own method, it is NOT A BREAKING CHANGE, it could be helpful This change is TESTED

    Little and marginal optimitations(less duplicity) https://github.com/spatie/laravel-permission/blob/67e54e2c7941d7aaa93c207549cdb7c5a44c68f5/src/Traits/HasPermissions.php#L132-L150 https://github.com/spatie/laravel-permission/blob/67e54e2c7941d7aaa93c207549cdb7c5a44c68f5/src/Traits/HasPermissions.php#L274-L286

    opened by angeljqv 0
  • Delegate permission collection filter to another method

    Delegate permission collection filter to another method

    This could help with customization of the package

    It is the same code, only i did move it to his own method, it is NOT A BREAKING CHANGE, it could be helpful This change is TESTED

    opened by angeljqv 0
  • Support static arrays on blade directives

    Support static arrays on blade directives

    Closes #2165 Closes https://github.com/spatie/laravel-permission/issues/1997#issuecomment-1019023930 Closes https://github.com/spatie/laravel-permission/issues/626#issuecomment-358911209 Closes #309

    This PR adds support for arrays(also expressions) on blade directives, example

    @hasanyrole(['admin', 'manager'])
            
    @endhasanyrole
    
    @hasallroles(['admin', 'manager'])
            
    @endhasallroles
    

    Without this PR only PIPE an VARIABLE's REF are supported https://github.com/spatie/laravel-permission/blob/dbc6c18ef4b2d097350a5faf82382564748e6c97/tests/resources/views/guardHasAllRolesPipe.blade.php#L1-L1 https://github.com/spatie/laravel-permission/blob/dbc6c18ef4b2d097350a5faf82382564748e6c97/tests/resources/views/guardHasAllRoles.blade.php#L1-L1

    opened by erikn69 0
  • Blade directive `@hasanyrole` does not work with array of role names

    Blade directive `@hasanyrole` does not work with array of role names

    Using blade templates this works:

    @hasanyrole('admin|manager')
            It works
    @endhasanyrole
    

    Unfortunately this piece of code raises an error:

    @hasanyrole(['admin', 'manager'])
            This should work, too
    @endhasanyrole
    

    The error points to the line with @hasanyrole and says: ParseError syntax error, unexpected ']', expecting ')'

    According to documentation at https://spatie.be/docs/laravel-permission/v5/basic-usage/blade-directives we should be able to pass $collectionOfRoles

    PS. This works as well:

    @if(auth()->user()->hasAnyRole(['admin', 'manager']))
            This works as well
    @endif
    

    Versions

    • spatie/laravel-permission package version: 5.5.5
    • laravel: 8.79.0
    • PHP version: 7.4.19
    • Database version: 10.6.4-MariaDB-log

    Expected behavior @hasanyrole should accept arrays

    opened by boryn 5
Releases(5.5.5)
  • 5.5.5(Jun 29, 2022)

    What's Changed

    • Custom primary keys tests(Only tests) by @erikn69 in https://github.com/spatie/laravel-permission/pull/2096
    • [PHP 8.2] Fix ${var} string interpolation deprecation by @Ayesh in https://github.com/spatie/laravel-permission/pull/2117
    • Use getKey, getKeyName instead of id by @erikn69 in https://github.com/spatie/laravel-permission/pull/2116
    • On WildcardPermission class use static instead of self for extending by @erikn69 in https://github.com/spatie/laravel-permission/pull/2111
    • Clear roles array after hydrate from cache by @angeljqv in https://github.com/spatie/laravel-permission/pull/2099

    New Contributors

    • @Ayesh made their first contribution in https://github.com/spatie/laravel-permission/pull/2117

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.4...5.5.5

    Source code(tar.gz)
    Source code(zip)
  • 5.5.4(May 16, 2022)

    What's Changed

    • Support custom primary key names on models by @erikn69 in https://github.com/spatie/laravel-permission/pull/2092
    • Fix UuidTrait on uuid doc page by @abhishekpaul in https://github.com/spatie/laravel-permission/pull/2094
    • Support custom fields on cache by @erikn69 in https://github.com/spatie/laravel-permission/pull/2091

    New Contributors

    • @abhishekpaul made their first contribution in https://github.com/spatie/laravel-permission/pull/2094

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.3...5.5.4

    Source code(tar.gz)
    Source code(zip)
  • 5.5.3(May 5, 2022)

    What's Changed

    • Update .gitattributes by @angeljqv in https://github.com/spatie/laravel-permission/pull/2065
    • Remove double semicolon from add_teams_fields.php.stub by @morganarnel in https://github.com/spatie/laravel-permission/pull/2067
    • [V5] Allow revokePermissionTo to accept Permission[] by @erikn69 in https://github.com/spatie/laravel-permission/pull/2014
    • [V5] Improve typing in role's findById and findOrCreate method by @itsfaqih in https://github.com/spatie/laravel-permission/pull/2022
    • [V5] Cache loader improvements by @erikn69 in https://github.com/spatie/laravel-permission/pull/1912

    New Contributors

    • @morganarnel made their first contribution in https://github.com/spatie/laravel-permission/pull/2067
    • @itsfaqih made their first contribution in https://github.com/spatie/laravel-permission/pull/2022

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.2...5.5.3

    Source code(tar.gz)
    Source code(zip)
  • 5.5.2(Mar 9, 2022)

    What's Changed

    • [Fixes BIG bug] register blade directives after resolving blade compiler by @tabacitu in https://github.com/spatie/laravel-permission/pull/2048

    New Contributors

    • @tabacitu made their first contribution in https://github.com/spatie/laravel-permission/pull/2048

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.1...5.5.2

    Source code(tar.gz)
    Source code(zip)
  • 5.5.1(Mar 3, 2022)

    What's Changed

    • Spelling correction by @gergo85 in https://github.com/spatie/laravel-permission/pull/2024
    • update broken link to laravel exception by @kingzamzon in https://github.com/spatie/laravel-permission/pull/2023
    • Fix Blade Directives incompatibility with renderers by @erikn69 in https://github.com/spatie/laravel-permission/pull/2039

    New Contributors

    • @gergo85 made their first contribution in https://github.com/spatie/laravel-permission/pull/2024
    • @kingzamzon made their first contribution in https://github.com/spatie/laravel-permission/pull/2023

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.0...5.5.1

    Source code(tar.gz)
    Source code(zip)
  • 5.5.0(Jan 11, 2022)

  • 5.4.2(Jan 3, 2022)

    What's Changed

    • Fix links to docs by @erikn69 in https://github.com/spatie/laravel-permission/pull/1973
    • [V5] Fix Duplicate entry 'roles_name_guard_name_unique' on migration for teams by @erikn69 in https://github.com/spatie/laravel-permission/pull/1970
    • [v5] [docs] fix use multiple guards link in basic usage page by @Kamona-WD in https://github.com/spatie/laravel-permission/pull/1965
    • [V5] Teams fixes(Only tests) by @erikn69 in https://github.com/spatie/laravel-permission/pull/1911
    • Use global helpers, Small fix by @angeljqv in https://github.com/spatie/laravel-permission/pull/1963
    • Replace is_array with Arr::wrap by @angeljqv in https://github.com/spatie/laravel-permission/pull/1962
    • Add Cache Repository getter on PermissionRegistrar by @angeljqv in https://github.com/spatie/laravel-permission/pull/1946

    New Contributors

    • @Kamona-WD made their first contribution in https://github.com/spatie/laravel-permission/pull/1965
    • @angeljqv made their first contribution in https://github.com/spatie/laravel-permission/pull/1963

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.4.1...5.4.2

    Source code(tar.gz)
    Source code(zip)
  • 5.4.1(Dec 17, 2021)

    What's Changed

    • Adds documentation for LazilyRefreshDatabase by @lukeraymonddowning in https://github.com/spatie/laravel-permission/pull/1952
    • Fix .gitattributes by @PaolaRuby in https://github.com/spatie/laravel-permission/pull/1945
    • Livewire Role and Permissions. by @alighasemzadeh in https://github.com/spatie/laravel-permission/pull/1928
    • Fix teams upgrade migration by @erikn69 in https://github.com/spatie/laravel-permission/pull/1959
    • [V5] WherePivot instead of only Where on team relation pivot, better readability by @erikn69 in https://github.com/spatie/laravel-permission/pull/1944

    New Contributors

    • @lukeraymonddowning made their first contribution in https://github.com/spatie/laravel-permission/pull/1952
    • @PaolaRuby made their first contribution in https://github.com/spatie/laravel-permission/pull/1945
    • @alighasemzadeh made their first contribution in https://github.com/spatie/laravel-permission/pull/1928

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.4.0...5.4.1

    Source code(tar.gz)
    Source code(zip)
  • 5.4.0(Nov 17, 2021)

    What's Changed

    • Add support for PHP 8.1 by @freekmurze in https://github.com/spatie/laravel-permission/pull/1926

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.3.2...5.4.0

    Source code(tar.gz)
    Source code(zip)
  • 5.3.2(Nov 17, 2021)

    What's Changed

    • [V5] Support for custom key names on Role,Permission by @erikn69 in https://github.com/spatie/laravel-permission/pull/1913

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.3.1...5.3.2

    Source code(tar.gz)
    Source code(zip)
  • 5.3.1(Nov 4, 2021)

    What's Changed

    • [V5] Fix hints, support int on scopePermission() (#1863) by @erikn69 in https://github.com/spatie/laravel-permission/pull/1908

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.3.0...5.3.1

    Source code(tar.gz)
    Source code(zip)
  • 5.3.0(Oct 29, 2021)

    What's Changed

    • [Docs] Update blade-directives.md by @rizkhal in https://github.com/spatie/laravel-permission/pull/1903
    • Option for custom logic for checking permissions by @ulhaq in https://github.com/spatie/laravel-permission/pull/1891

    New Contributors

    • @rizkhal made their first contribution in https://github.com/spatie/laravel-permission/pull/1903
    • @ulhaq made their first contribution in https://github.com/spatie/laravel-permission/pull/1891

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.2.0...5.3.0

    Source code(tar.gz)
    Source code(zip)
  • 5.2.0(Oct 28, 2021)

    What's Changed

    • [V5] Fix detaching on all teams intstead of only current #1888 by @erikn69 in https://github.com/spatie/laravel-permission/pull/1890
    • [V5] Add uuid compatibility support on teams by @erikn69 in https://github.com/spatie/laravel-permission/pull/1857
    • Adds setRoleClass method to PermissionRegistrar by @timschwartz in https://github.com/spatie/laravel-permission/pull/1867
    • Load permissions for preventLazyLoading by @bahramsadin in https://github.com/spatie/laravel-permission/pull/1884
    • [V5] Doc for Super Admin on teams by @erikn69 in https://github.com/spatie/laravel-permission/pull/1845

    New Contributors

    • @timschwartz made their first contribution in https://github.com/spatie/laravel-permission/pull/1867
    • @bahramsadin made their first contribution in https://github.com/spatie/laravel-permission/pull/1884

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.1.1...5.2.0

    Source code(tar.gz)
    Source code(zip)
  • 4.4.3(Oct 28, 2021)

    What's Changed

    • [V4] Fix hints, support int on scopePermission() by @erikn69 in https://github.com/spatie/laravel-permission/pull/1863

    Full Changelog: https://github.com/spatie/laravel-permission/compare/4.4.1...4.4.3

    Source code(tar.gz)
    Source code(zip)
  • 4.4.2(Oct 28, 2021)

    What's Changed

    • [V4] Fix hints, support int on scopePermission() by @erikn69 in https://github.com/spatie/laravel-permission/pull/1863

    Full Changelog: https://github.com/spatie/laravel-permission/compare/4.4.1...4.4.2

    Source code(tar.gz)
    Source code(zip)
  • 5.1.1(Sep 1, 2021)

  • 4.4.1(Sep 1, 2021)

  • 5.1.0(Aug 31, 2021)

    • No longer flushes cache when changing role/permission assignments to users because user cache is in-memory. #1832 (It now only flushes when changing permissions-assigned-to-roles, or roles-assigned-to-permissions.) NOTE: You should test your app to be sure that you don't accidentally have deep dependencies on cache resets happening automatically in these cases. ALSO NOTE: If you have added custom code which depended on these flush operations, you may need to add your own cache-reset calls.
    Source code(tar.gz)
    Source code(zip)
  • 5.0.0(Aug 31, 2021)

    • Change default-guard-lookup to prefer current user's guard This has been requested for a long time, but has potential breaking-changes. See BC note in #1817

    • Added Teams/Groups feature (see docs, or PR #1804)

    • Customized pivots instead of role_id,permission_id #1823

    Source code(tar.gz)
    Source code(zip)
  • 4.4.0(Aug 28, 2021)

    • Avoid BC break (removed interface change) on cache change added in 4.3.0 #1826
    • Made cache even smaller #1826
    • Avoid re-sync on non-persisted objects when firing Eloquent::saved #1819
    Source code(tar.gz)
    Source code(zip)
  • 4.3.0(Aug 17, 2021)

  • 4.2.0(Jun 4, 2021)

  • 4.1.0(Jun 2, 2021)

  • 4.0.1(Mar 22, 2021)

    No core changes. Simply added comments to migration file to explain how to avoid "Specified key is too long ... must not be more than 1000 bytes" errors on MySQL.

    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(Jan 27, 2021)

    4.0.0 - 2021-01-27

    • Drop support on Laravel 5.8 #1615
    • Fix bug when adding roles to a model that doesn't yet exist #1663
    • Enforce unique constraints on database level #1261
    • Changed PermissionRegistrar::initializeCache() public to allow reinitializing cache in custom situations. #1521
    • Use Eloquent\Collection instead of Support\Collection for consistency, collection merging, etc #1630

    This package now requires PHP 7.2.5 and Laravel 6.0 or higher. If you are on a PHP version below 7.2.5 or a Laravel version below 6.0 you can use an older version of this package.

    Source code(tar.gz)
    Source code(zip)
  • 3.18.0(Nov 27, 2020)

  • 3.17.0(Sep 16, 2020)

    • Optional $guard parameter may be passed to RoleMiddleware, PermissionMiddleware, and RoleOrPermissionMiddleware. See #1565 Thanks @lloricode
    Source code(tar.gz)
    Source code(zip)
  • 3.16.0(Aug 18, 2020)

  • 3.15.0(Aug 15, 2020)

  • 3.14.0(Aug 15, 2020)

Owner
Spatie
Webdesign agency based in Antwerp, Belgium
Spatie
Laravel Users (Roles & Permissions, Devices, Password Hashing, Password History).

LARAVEL USERS Roles & Permissions Devices Password Hashing Password History Documentation You can find the detailed documentation here in Laravel User

Pharaonic 7 Sep 12, 2022
Laravel Auth is a Complete Build of Laravel 8 with Email Registration Verification, Social Authentication, User Roles and Permissions, User Profiles, and Admin restricted user management system.

Laravel Auth is a Complete Build of Laravel 8 with Email Registration Verification, Social Authentication, User Roles and Permissions, User Profiles, and Admin restricted user management system. Built on Bootstrap 4.

Jeremy Kenedy 2.8k Sep 12, 2022
Tech-Admin is Laravel + Bootstrap Admin Panel With User Management And Access Control based on Roles and Permissions.

Tech-Admin | Laravel 8 + Bootstrap 4 Tech-Admin is Admin Panel With Preset of Roles, Permissions, ACL, User Management, Profile Management. Features M

TechTool India 30 Sep 16, 2022
Handle roles and permissions in your Laravel application

Laratrust (Laravel Package) Version Compatibility Laravel Laratrust 8.x 6.x 7.x 6.x 6.x 6.x 5.6.x - 5.8.x 5.2 5.3.x - 5.5.x 5.1 5.0.x - 5.2.x 4.0. Ins

Santiago García 1.9k Sep 20, 2022
Powerful package for handling roles and permissions in Laravel 5

Roles And Permissions For Laravel 5 Powerful package for handling roles and permissions in Laravel 5 (5.1 and also 5.0). Installation Composer Service

Roman Bičan 1.2k Aug 5, 2022
Laravel Roles and Permissions

Introduction to Laravel Roles and Permission App Starter Kit Roles and sanctions are a paramount part of many web applications. In project, we have op

Brian Kiprono Koech 1 Nov 1, 2021
A Powerful package for handling roles and permissions in Laravel with GUI.

Laravel Roles A Powerful package for handling roles and permissions in Laravel. Supports Laravel 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0, and 8.0+. Tab

Jeremy Kenedy 785 Sep 17, 2022
This is a lightweight package that allows you assign roles and permissions to any Laravel model, or on a pivot table (many to many relationship).

Simple Laravel roles and permissions Introduction This package allows you to assign roles and permissions to any laravel model, or on a pivot table (m

null 50 Aug 23, 2022
Roles & Permissions for Laravel 8 / 7 / 6 / 5

Defender Defender is an Access Control List (ACL) Solution for Laravel 5 / 6 / 7 (single auth). (Not compatible with multi-auth) With security and usa

Artesãos 434 Sep 12, 2022
PermissionsMakr is a Laravel package that will help any developer to easily manage the system's users permissions

PermissionsMakr is a Laravel package that will help any developer to easily manage the system's users permissions

Alvarium Digital 3 Nov 30, 2021
Eloquent roles and abilities.

Bouncer Bouncer is an elegant, framework-agnostic approach to managing roles and abilities for any app using Eloquent models. Table of Contents Click

Joseph Silber 3.1k Sep 18, 2022
Proyecto para aprender a utilizar privilegios (roles y permisos) con CRUDBooster

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Informática DP 3 May 9, 2022
Role-based Permissions for Laravel 5

ENTRUST (Laravel 5 Package) Entrust is a succinct and flexible way to add Role-based Permissions to Laravel 5. If you are looking for the Laravel 4 ve

Zizaco 6.1k Sep 16, 2022
Light-weight role-based permissions system for Laravel 6+ built in Auth system.

Kodeine/Laravel-ACL Laravel ACL adds role based permissions to built in Auth System of Laravel 8.0+. ACL middleware protects routes and even crud cont

Kodeine 776 Sep 14, 2022
Manage authorization with granular role-based permissions in your Laravel Apps.

Governor For Laravel Manage authorization with granular role-based permissions in your Laravel apps. Goal Provide a simple method of managing ACL in a

GeneaLabs, LLC 147 Jul 25, 2022
Laravel mongodb permissions

Laravel mongodb permissions

null 4 May 10, 2022
this is a semester project using Laravel, this app allow user to keep and shear their note with other users.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Vichhagar Nhin 0 Dec 24, 2021
EAuth extension allows to authenticate users by the OpenID, OAuth 1.0 and OAuth 2.0 providers

EAuth extension allows to authenticate users with accounts on other websites. Supported protocols: OpenID, OAuth 1.0 and OAuth 2.0.

Maxim Zemskov 330 Jun 3, 2022
Laravel package to easily login as other users during development.

A Laravel 5.4 utility package to enable developers to log in as other users during development. Installation To install the package, simply follow the

VIA Creative 555 Aug 18, 2022