laravel-acl
laravel-acl copied to clipboard
Resolve permissions inheritance based on roles issue
See https://github.com/kodeine/laravel-acl/issues/168
If you're using the laravel cache, do php artisan cache:clear to have it work.
Edit: Cache::forget() added when assign/revoke Role/Permission
@QuentinPetel can you please resolve the conflicts so i can merge this?
Thanks
Done.
One thing however still not fixed. If you already have an $user loaded, you have to ::find this user again to avoid getting roles or permissions outdated.
Something like : $user->assignRole('slug_role'); $user = User::find($user->id);
Something like : $user->assignRole('slug_role'); $user = User::find($user->id);
Just a few days ago a refresh method has been added to Model (bot not yet released). So you could use $this->refresh(); within assignRole now. For older versions you could implement the refresh yourself.
if (version_compare(App::version(), '5.4.24', '>=')) { // Version number is a guess
$this->refresh();
} else {
if (! $this->exists) {
return;
}
$this->load(array_keys($this->relations));
$this->setRawAttributes(static::findOrFail($this->getKey())->attributes);
}