Skip to content

Commit

Permalink
Fix non-admins unable to create redirects (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mosnar committed Jul 24, 2024
1 parent 43e6e95 commit 8af5563
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Redirect Changelog

## 4.0.0-beta.7 - 2024-07-24

### Fixed

- Fixed issue preventing non-admins from creating redirects

## 4.0.0-beta.7 - 2024-06-27

### Added
Expand Down
8 changes: 4 additions & 4 deletions src/elements/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ public function canView(User $user): bool
return true;
}

return $user->can(Plugin::PERMISSION_MANAGE_REDIRECTS) && $user->can('editSite:' . $this->site->uid);
return $user->can(Plugin::PERMISSION_MANAGE_REDIRECTS);
}


Expand All @@ -1078,22 +1078,22 @@ public function canDelete(User $user): bool
if (parent::canDelete($user)) {
return true;
}
return $user->can(Plugin::PERMISSION_MANAGE_REDIRECTS) && $user->can('editSite:' . $this->site->uid);
return $user->can(Plugin::PERMISSION_MANAGE_REDIRECTS);
}

public function canSave(User $user): bool
{
if (parent::canSave($user)) {
return true;
}
return $user->can(Plugin::PERMISSION_MANAGE_REDIRECTS) && $user->can('editSite:' . $this->site->uid);
return $user->can(Plugin::PERMISSION_MANAGE_REDIRECTS);
}

public function canDeleteForSite(User $user): bool
{
if (parent::canDeleteForSite($user)) {
return true;
}
return $user->can(Plugin::PERMISSION_MANAGE_REDIRECTS) && $user->can('editSite:' . $this->site->uid);
return $user->can(Plugin::PERMISSION_MANAGE_REDIRECTS);
}
}

0 comments on commit 8af5563

Please sign in to comment.