Skip to content

Commit

Permalink
further simplify ContentPolicy::edit
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachughes committed Jan 8, 2025
1 parent 925626f commit e59dd1a
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions sourcecode/hub/app/Policies/ContentPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,17 @@ public function edit(
return true;
}

if ($content->hasUserWithMinimumRole($user, ContentRole::Editor)) {
return true;
}

$platform = $this->getLtiPlatform();

if ($platform) {
if (
$platform->authorizes_edit &&
$this->request->session()->has('intent-to-edit.' . $content->id)
) {
return true;
}
if (
$platform?->authorizes_edit &&
$this->request->session()->has('intent-to-edit.' . $content->id)
) {
return true;
}

if ($this->hasContentRole(ContentRole::Editor, $content, $user, $platform)) {
return true;
}
if ($this->hasContentRole(ContentRole::Editor, $content, $user, $platform)) {
return true;
}

return false;
Expand Down

0 comments on commit e59dd1a

Please sign in to comment.