Skip to content
Snippets Groups Projects

Issue #2907696 by tr, pifagor, mroycroft, kevin.dutra: Unable to see any...

Merged Tim Rohaly requested to merge issue/votingapi-2907696:2907696-unable-to-see into 4.0.x
Files
3
@@ -22,7 +22,22 @@ class VoteAccessControlHandler extends EntityAccessControlHandler {
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
return $operation == 'delete' ? AccessResult::allowedIfHasPermission($account, 'delete votes') : AccessResult::allowed();
switch ($operation) {
case 'delete':
return AccessResult::allowedIfHasPermission($account, 'delete votes');
case 'view':
if ($account->hasPermission('view any vote')) {
return AccessResult::allowed()->cachePerPermissions();
}
if ($account->hasPermission('view own vote') && $account->id() == $entity->getOwnerId()) {
return AccessResult::allowed()->cachePerUser();
}
return parent::checkAccess($entity, $operation, $account);
default:
return parent::checkAccess($entity, $operation, $account);
}
}
/**
Loading