Unverified Commit 7748145a authored by nicola85's avatar nicola85 Committed by GitHub

Merge pull request #51 from Roomify/issue-2946500

fix owner check
parents 7704b8ec 735bb4ee
......@@ -196,7 +196,7 @@ function bat_entity_access(EntityInterface $entity, $operation, AccountInterface
}
// Then check an authenticated user's access to delete his own entities.
if ($account->id() && $entity_info->getKey('uid') !== FALSE && isset($entity->{$entity_info->getKey('uid')}) && $entity->{$entity_info->getKey('uid')} == $account->id()) {
if ($account->id() && $entity->getOwnerId() && $entity->getOwnerId() === $account->id()) {
if ($account->hasPermission($operation . ' own ' . $entity_type . ' entities') ||
$account->hasPermission($operation . ' own ' . $entity_type . ' entities of bundle ' . $bundle_name)) {
$rights[$account->id()][$cid][$operation] = TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment