diff --git a/app/Permission.php b/app/Permission.php index 794df01ab..a146dcf63 100644 --- a/app/Permission.php +++ b/app/Permission.php @@ -11,7 +11,7 @@ class Permission extends Model */ public function roles() { - return $this->belongsToMany('BookStack\Permissions'); + return $this->belongsToMany('BookStack\Role'); } /** diff --git a/app/Role.php b/app/Role.php index 270e4e0b8..4e14db181 100644 --- a/app/Role.php +++ b/app/Role.php @@ -43,6 +43,15 @@ class Role extends Model $this->permissions()->attach($permission->id); } + /** + * Detach a single permission from this role. + * @param Permission $permission + */ + public function detachPermission(Permission $permission) + { + $this->permissions()->detach($permission->id); + } + /** * Get the role object for the specified role. * @param $roleName