if ($account->id() == $entity->getOwnerId()) {
$permissions = [
"$operation own {$entity->getEntityTypeId()}",
"$operation any {$entity->getEntityTypeId()}",
"$operation own {$entity->bundle()} {$entity->getEntityTypeId()}",
"$operation any {$entity->bundle()} {$entity->getEntityTypeId()}",
];
}
else {
$permissions = [
"$operation any {$entity->getEntityTypeId()}",
"$operation any {$entity->bundle()} {$entity->getEntityTypeId()}",
];
}
$result = AccessResult::allowedIfHasPermissions($account, $permissions, 'OR');
Looks like a pure omission. This code checks the owner ID, but doesn't add ->cachePerUser() to the result, even though it must.
Comments
Comment #3
bojanz commentedFixed.