You are here

function book_access_node_access_explain in Book access 1.x

Same name and namespace in other branches
  1. 6.2 book_access.module \book_access_node_access_explain()
  2. 6 book_access.module \book_access_node_access_explain()
  3. 7.2 book_access.module \book_access_node_access_explain()

Implements hook_node_access_explain().

Hook_node_access_explain() is defined in devel_node_access.module, which helps you to figure out how node access works and what permissions are currently granted.

File

./book_access.module, line 333

Code

function book_access_node_access_explain($row) {

  /*  static $roles = NULL;
    $result = array();

    if ($row->realm == 'book_access_author') {
    $result = array(
    t('Grants for book authors')
    );
    }
    elseif ($row->realm == 'book_access_role') {
    if (!isset($roles)) {
    $roles = user_roles();
    }

    if (isset($roles[$row->gid])) {
    $result = array(
    t('Grants for users of role %role',
    array('%role' => $roles[$row->gid])
    )
    );
    }
    else {
    $result = array(
    t('Unknown group ID %gid',
    array('%gid' => $row->gid)
    )
    );
    }
    }
    elseif ($row->realm == 'book_access_user') {
    if ($user = \Drupal::entityTypeManager()->getStorage('user')->load($row->gid)) {
    $result = array(
    t('Grants for user %username',
    array('%username' => $user->name)
    )
    );
    }
    else {
    $result = array(
    t('Unknown user ID %gid',
    array('%gid' => $row->gid)
    )
    );
    }
    }

    return $result;*/
}