You are here

function opigno_learning_path_group_content_create_access in Opigno Learning path 3.x

Same name and namespace in other branches
  1. 8 opigno_learning_path.module \opigno_learning_path_group_content_create_access()

Implements hook_ENTITY_TYPE_create_access().

File

./opigno_learning_path.module, line 1917
Contains opigno_learning_path.module.

Code

function opigno_learning_path_group_content_create_access(AccountInterface $account, array $context, $entity_bundle) {
  if (in_array($entity_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 create new user group membership.
    return AccessResult::allowed();
  }
  return AccessResult::neutral();
}