Skip to content

Commit

Permalink
Merge pull request #2180 from Daniel-KM/fix/assertion_owner
Browse files Browse the repository at this point in the history
Fixed assertion OwnsEntityAssertion when the check is done against a doctrine proxy.
  • Loading branch information
zerocrates committed May 21, 2024
2 parents 1ba0984 + fb64bb5 commit 49ef999
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ class OwnsEntityAssertion implements AssertionInterface
public function assert(Acl $acl, RoleInterface $role = null,
ResourceInterface $resource = null, $privilege = null
) {
if (!$role || !$role instanceof \Omeka\Entity\User) {
return false;
}
if ($resource instanceof Value) {
$resource = $resource->getResource();
}
return $role && $role === $resource->getOwner();
$owner = $resource->getOwner();
return $owner && $role->getId() === $owner->getId();
}
}

0 comments on commit 49ef999

Please sign in to comment.