Skip to content

Commit

Permalink
Merge pull request linnovate#102 from istolar/OI-74-automatically-fol…
Browse files Browse the repository at this point in the history
…low-group-ideas

OI-74: Restrict access of author to remove himself from a group.
  • Loading branch information
db-Matroskeen committed Jul 24, 2020
2 parents ed2d5cb + b334ec4 commit aa805ca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/openideal_idea/openideal_idea.module
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,14 @@ function openideal_idea_entity_type_build(array &$entity_types) {
// To add "un-like" ability to the Idea bundle.
$entity_types['vote']->setFormClass('votingapi_openideal_useful', OpenidealBaseRatingForm::class);
}

/**
* Implements hook_ENTITY_TYPE_access().
*/
function openideal_idea_group_content_access(EntityInterface $entity, $operation, AccountInterface $account) {
if ($entity->getOwnerId() === $account->id()
&& $operation == 'delete'
&& $entity->getContentPlugin()->getPluginId() == 'group_membership') {
return AccessResult::forbidden();
}
}

0 comments on commit aa805ca

Please sign in to comment.