You are here

function registration_administer_registrations_access in Entity Registration 8

Same name and namespace in other branches
  1. 8.2 registration.module \registration_administer_registrations_access()
  2. 7.2 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()

2 calls to registration_administer_registrations_access()
registration_handler_field_entity_settings_link::render_link in src/registration_handler_field_entity_settings_link.php
Renders the link.
registration_handler_field_entity_settings_link::render_link in modules/registration_views/includes/registration_handler_field_entity_settings_link.inc
Renders the link.
1 string reference to 'registration_administer_registrations_access'
registration_menu in ./registration.module
@FIXME This implementation of hook_menu() cannot be automatically converted because it contains logic (i.e., branching statements, function calls, object instantiation, etc.) You will need to convert it manually. Sorry!

File

./registration.module, line 518

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 ($account
      ->hasPermission("administer {$registration_type} registration")) {
      return TRUE;
    }
    elseif ($account
      ->hasPermission("update own {$registration_type} registration") && entity_access('update', $entity_type, $entity, $account)) {
      return TRUE;
    }
  }
  return FALSE;
}