protected function GroupContentEnablerBase::deleteAccess in Group 8
Performs access check for the delete operation.
This method is supposed to be overwritten by extending classes that do their own custom access checking.
Parameters
\Drupal\group\Entity\GroupContentInterface $group_content: The group content for which to check access.
\Drupal\Core\Session\AccountInterface $account: The user for which to check access.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 call to GroupContentEnablerBase::deleteAccess()
- GroupContentEnablerBase::checkAccess in src/
Plugin/ GroupContentEnablerBase.php - Checks access to an operation on a given group content entity.
File
- src/
Plugin/ GroupContentEnablerBase.php, line 373
Class
- GroupContentEnablerBase
- Provides a base class for GroupContentEnabler plugins.
Namespace
Drupal\group\PluginCode
protected function deleteAccess(GroupContentInterface $group_content, AccountInterface $account) {
$group = $group_content
->getGroup();
$plugin_id = $this
->getPluginId();
// Allow members to delete their own group content.
if ($group_content
->getOwnerId() == $account
->id()) {
return GroupAccessResult::allowedIfHasGroupPermission($group, $account, "delete own {$plugin_id} content");
}
return GroupAccessResult::allowedIfHasGroupPermission($group, $account, "delete any {$plugin_id} content");
}