You are here

function registration_administer_registrations_access in Entity Registration 7.2

Same name and namespace in other branches
  1. 8.2 registration.module \registration_administer_registrations_access()
  2. 8 registration.module \registration_administer_registrations_access()
  3. 7 registration.module \registration_administer_registrations_access()

Access callback: for registration_registrations_page().

Check if user has access to administer registrations for a host entity.

Parameters

string $entity_type: The host entity type.

object $entity: The host entity.

object $account = NULL: An account for which to check access. If NULL is provided the current user is used.

Return value

bool Whether a user can view registrations for a host entity.

See also

registration_registrations_page()

registration_menu()

1 call to registration_administer_registrations_access()
registration_handler_field_entity_settings_link::render_link in modules/registration_views/includes/registration_handler_field_entity_settings_link.inc
Renders the link.
2 string references to 'registration_administer_registrations_access'
registration_checkin_menu in modules/registration_checkin/registration_checkin.module
Implements hook_menu().
registration_menu in ./registration.module
Implements hook_menu().

File

./registration.module, line 608

Code

function registration_administer_registrations_access($entity_type, $entity, $account = NULL) {
  $registration_type = registration_get_entity_registration_type($entity_type, $entity);
  if ($registration_type) {
    if (user_access("administer {$registration_type} registration", $account)) {
      return TRUE;
    }
    elseif (user_access("update own {$registration_type} registration", $account) && entity_access('update', $entity_type, $entity, $account)) {
      return TRUE;
    }
  }
  return FALSE;
}