You are here

function _group_add_access in Group 7

Access callback: Checks whether the user has permission to add a group.

See also

GroupUiController::hook_menu()

1 string reference to '_group_add_access'
GroupUIController::hook_menu in classes/group.ui_controller.inc
Provides definitions for implementing hook_menu().

File

./group.router.inc, line 63
Contains all router functions for the Group module.

Code

function _group_add_access() {
  foreach (group_types() as $group_type) {
    $group = entity_create('group', array(
      'type' => $group_type->name,
    ));
    if (entity_access('create', 'group', $group)) {
      return TRUE;
    }
  }
  if (user_access('configure group module')) {

    // There are no group types defined that the user has permission to create,
    // but the user does have the permission to administer the group types, so
    // grant them access to the page anyway.
    return TRUE;
  }
  return FALSE;
}