function opigno_learning_path_group_content_access in Opigno Learning path 8
Same name and namespace in other branches
- 3.x opigno_learning_path.module \opigno_learning_path_group_content_access()
Implements hook_ENTITY_TYPE_access().
File
- ./
opigno_learning_path.module, line 1978 - Contains opigno_learning_path.module.
Code
function opigno_learning_path_group_content_access(EntityInterface $entity, $operation, AccountInterface $account) {
$bundle = $entity
->bundle();
if (in_array($bundle, [
'opigno_class-group_membership',
'opigno_course-group_membership',
'learning_path-group_membership',
]) && $account
->hasPermission('manage group members in any group')) {
// Allow platform-level user managers
// to view/edit/delete user group membership.
return AccessResult::allowed();
}
return AccessResult::neutral();
}