You are here

function simple_access_node_access_explain in Simple Access 6.2

Same name and namespace in other branches
  1. 8.3 simple_access.module \simple_access_node_access_explain()
  2. 5.2 simple_access.module \simple_access_node_access_explain()
  3. 7.2 simple_access.module \simple_access_node_access_explain()

Implementation of hook_node_access_explain()

File

./simple_access.module, line 292
This module allows administrators to make nodes viewable by specific 'access groups'. Each access group can contain any number of roles. If a node is not assigned to any access groups, it will remain viewable by all users.

Code

function simple_access_node_access_explain($row) {
  switch ($row->realm) {
    case 'simple_access_author':
      return t('Access for the content owner');
    case 'simple_access':
      $groups = simple_access_get_groups();
      return t('Access restrictions for the "%group" group', array(
        '%group' => $groups[$row->gid]['name'],
      ));
    case 'simple_access_profile':
      $groups = simple_access_get_groups();
      $profiles = simple_access_get_profiles();
      $profile = $profiles[$row->gid];
      $message = t('Access restrictions for profile "%profile"<br /><dt>', array(
        '%profile' => $profile['name'],
      ));
      if (!empty($profile['access'])) {
        foreach ($profile['access'] as $gid => $access) {
          $message .= t(' "%group" group can @perm.', array(
            '%group' => $groups[$gid]['name'],
            '@perm' => implode(', ', array_keys(array_filter($access))),
          ));
        }
      }
      $message .= '</dt>';
      return $message;
  }
}