Skip to content
Snippets Groups Projects

add permission for voting on own content

2 files
+ 10
0
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -179,6 +179,9 @@ abstract class VotingApiWidgetBase extends PluginBase implements VotingApiWidget
@@ -179,6 +179,9 @@ abstract class VotingApiWidgetBase extends PluginBase implements VotingApiWidget
if (!$vote->isNew()) {
if (!$vote->isNew()) {
$perm = 'edit own vote on ' . $vote->getVotedEntityType() . ':' . $entity->bundle() . ':' . $vote->field_name->value;
$perm = 'edit own vote on ' . $vote->getVotedEntityType() . ':' . $entity->bundle() . ':' . $vote->field_name->value;
}
}
 
if ($account->id() && $entity->getOwnerId() == $account->id()) {
 
$perm = 'vote on own ' . $vote->getVotedEntityType() . ':' . $entity->bundle() . ':' . $vote->field_name->value;
 
}
return $account->hasPermission($perm);
return $account->hasPermission($perm);
}
}
Loading