Added album deletion policy
This commit is contained in:
parent
e1ad66c9ef
commit
c3ce6e1d71
@ -54,6 +54,23 @@ class AlbumPolicy
|
|||||||
return $this->userHasPermission($user, $album, $permission);
|
return $this->userHasPermission($user, $album, $permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete(User $user, Album $album)
|
||||||
|
{
|
||||||
|
if ($user->id == $album->user_id)
|
||||||
|
{
|
||||||
|
// The album's owner and can do everything
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the edit permission
|
||||||
|
$permission = Permission::where([
|
||||||
|
'section' => 'album',
|
||||||
|
'description' => 'delete'
|
||||||
|
])->first();
|
||||||
|
|
||||||
|
return $this->userHasPermission($user, $album, $permission);
|
||||||
|
}
|
||||||
|
|
||||||
public function deletePhotos(User $user, Album $album)
|
public function deletePhotos(User $user, Album $album)
|
||||||
{
|
{
|
||||||
if ($user->id == $album->user_id)
|
if ($user->id == $album->user_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user