Skip to content

Commit

Permalink
Merge pull request #42 from tv2regionerne/feature/user-permissions
Browse files Browse the repository at this point in the history
Fix currect user object for permission check
  • Loading branch information
SylvesterDamgaard authored Sep 25, 2024
2 parents 4fa55cc + ed4d4f9 commit 70ae007
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Policies/CuratedCollectionPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public function view($user, CuratedCollection $curatedCollection)
*/
public function create($user)
{
$user = \Statamic\Facades\User::fromUser($user);

if ($user->hasPermission('create curated-collections')) {
return true;
}
Expand All @@ -78,6 +80,8 @@ public function create($user)
*/
public function update($user, CuratedCollection $curatedCollection)
{
$user = \Statamic\Facades\User::fromUser($user);

if ($user->hasPermission('edit curated-collections')) {
return true;
}
Expand All @@ -96,6 +100,8 @@ public function update($user, CuratedCollection $curatedCollection)
*/
public function delete($user, CuratedCollection $curatedCollection)
{
$user = \Statamic\Facades\User::fromUser($user);

if ($user->hasPermission('delete curated-collections')) {
return true;
}
Expand Down

0 comments on commit 70ae007

Please sign in to comment.