You are here

function access_grant_label in Access Control Kit 7

Entity label callback for an access grant.

See also

callback_entity_info_label()

1 call to access_grant_label()
AccessGrantInterfaceTest::testGrantDelete in ./access.test
Delete an access grant via the user interface.
1 string reference to 'access_grant_label'
access_entity_info in ./access.module
Implements hook_entity_info().

File

./access.module, line 77
The access control kit module.

Code

function access_grant_label($grant) {

  // Load the primary descriptors of the grant.
  $account = user_load($grant->uid);
  $role = user_role_load($grant->rid);

  // Dereference the descriptors.
  $username = empty($account) ? $grant->uid : format_username($account);
  $rolename = empty($role) ? $grant->rid : $role->name;

  // We use !token instead of @token because an entity label callback is
  // supposed to return an unsanitized string.
  return t("!user's access as !role", array(
    '!user' => $username,
    '!role' => $rolename,
  ));
}