]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Models/Entity.php
Started code update for new entity permission format
[bookstack] / app / Entities / Models / Entity.php
index 3528eaf2becee478ab19b5c60f10d125f34a22f6..a5254875d5f40b7db97e8e173d2a1c05dab6714e 100644 (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;
     }