From 6aa43bbdf9df91cd172d93ffe13ad102b2ca87bc Mon Sep 17 00:00:00 2001 From: Kyrch Date: Mon, 13 Nov 2023 20:35:34 -0300 Subject: [PATCH] fix: added attach resources to song policy (#610) --- app/Policies/Wiki/SongPolicy.php | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app/Policies/Wiki/SongPolicy.php b/app/Policies/Wiki/SongPolicy.php index 7df7568a9..0bc449d61 100644 --- a/app/Policies/Wiki/SongPolicy.php +++ b/app/Policies/Wiki/SongPolicy.php @@ -147,4 +147,37 @@ class SongPolicy { return $user->can(CrudPermission::UPDATE->format(Song::class)); } + + /** + * Determine whether the user can attach any resource to the song. + * + * @param User $user + * @return bool + */ + public function attachAnyExternalResource(User $user): bool + { + return $user->can(CrudPermission::UPDATE->format(Song::class)); + } + + /** + * Determine whether the user can attach a resource to the song. + * + * @param User $user + * @return bool + */ + public function attachExternalResource(User $user): bool + { + return $user->can(CrudPermission::UPDATE->format(Song::class)); + } + + /** + * Determine whether the user can detach a resource from the song. + * + * @param User $user + * @return bool + */ + public function detachExternalResource(User $user): bool + { + return $user->can(CrudPermission::UPDATE->format(Song::class)); + } }