Skip to content

Associate users with roles and permissions and handle if user or role blocked for a permission

License

Notifications You must be signed in to change notification settings

mahdimsr/laravel-permission-block

 
 

Repository files navigation

Associate users with permissions and roles

About

This package is forked from laravel-permission developed by spatie

What It Different?

In additional main package, this package allows you to block user from permissions

Once installed you can do stuff like this:

$user->blockedPermissions // all permissions are blocked for user

// Block user from permission
$user->blockFromPermission('edit articles');
$user->blockFromPermission(['edit articles','view post']);

$user->hasBlockFromPermission('edit articles'); // return true
$user->hasDirectPermission('edit articles'); // return false
$user->hasPermissionTo('edit articles'); // return false
$user->can('edit articles'); // return false

$user->hasBlockFromAnyPermission(['edit article','view post']) // return true if any of passing permissions array are blocked

$user->unblockFromPermission('view post')

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

Security

If you discover any security-related issues, please email mahdi.msr4@gmail.com.

License

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

About

Associate users with roles and permissions and handle if user or role blocked for a permission

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.5%
  • Blade 0.5%