1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Started code update for new entity permission format

This commit is contained in:
Dan Brown
2022-10-08 13:52:59 +01:00
parent 1d3dbd6f6e
commit aee0e16194
9 changed files with 70 additions and 43 deletions

View File

@ -176,7 +176,7 @@ abstract class Entity extends Model implements Sluggable, Favouritable, Viewable
*/
public function permissions(): MorphMany
{
return $this->morphMany(EntityPermission::class, 'restrictable');
return $this->morphMany(EntityPermission::class, 'entity');
}
/**
@ -186,7 +186,7 @@ abstract class Entity extends Model implements Sluggable, Favouritable, Viewable
{
return $this->permissions()
->where('role_id', '=', $role_id)
->where('action', '=', $action)
->where($action, '=', true)
->count() > 0;
}