function simple_access_node_access_explain in Simple Access 7.2
Same name and namespace in other branches
- 8.3 simple_access.module \simple_access_node_access_explain()
- 5.2 simple_access.module \simple_access_node_access_explain()
- 6.2 simple_access.module \simple_access_node_access_explain()
Implements hook_node_access_explain().
File
- ./
simple_access.module, line 372 - 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) {
$perms = array(
t('View') => $access['sa_view'],
t('Update') => $access['sa_update'],
t('Delete') => $access['sa_delete'],
);
$message .= t('"%group" group can @perm.', array(
'%group' => $groups[$gid]['name'],
'@perm' => implode(', ', array_keys(array_filter($perms))),
));
}
}
$message .= '</dt>';
return $message;
}
}