Skip to content

Commit

Permalink
Merge pull request #51 from Roomify/issue-2946500
Browse files Browse the repository at this point in the history
fix owner check
  • Loading branch information
nicolocaruso85 authored Feb 24, 2018
2 parents 7704b8e + 735bb4e commit 7748145
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bat.module
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7748145

Please sign in to comment.