Skip to content

Commit

Permalink
Fixed assertion OwnsEntityAssertion when the check is done against a …
Browse files Browse the repository at this point in the history
…doctrine proxy.
  • Loading branch information
Daniel Berthereau authored and Daniel Berthereau committed Apr 8, 2024
1 parent 2c1e292 commit fb64bb5
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 fb64bb5

Please sign in to comment.