You are here

function og_ui_user_access_group in Organic groups 7.2

Menu access; Check if entity is a group, and user has permission.

2 calls to og_ui_user_access_group()
hook_og_ui_get_group_admin_alter in og_ui/og_ui.api.php
Alter existing group admin menu items.
og_handler_field_og_membership_link_edit::render_link in includes/views/handlers/og_handler_field_og_membership_link_edit.inc
1 string reference to 'og_ui_user_access_group'
og_ui_menu in og_ui/og_ui.module
Implements hook_menu().

File

og_ui/og_ui.module, line 318
Organic groups UI.

Code

function og_ui_user_access_group($perm, $group_type, $gid) {
  $group = entity_load_single($group_type, $gid);
  if (!$group || !og_is_group($group_type, $group)) {
    return FALSE;
  }

  // Extract the group's bundle.
  list(, , $bundle) = entity_extract_ids($group_type, $group);

  // Verify the bundle has roles
  if (!og_roles($group_type, $bundle, $gid)) {
    return FALSE;
  }
  return og_user_access($group_type, $gid, $perm);
}