Salah satu cara yang dapat Anda lakukan adalah membuat modul khusus, mencetak info akses pada setiap halaman, setiap node, setiap blok.
fungsi menu_get_item () mengembalikan item router yang memiliki properti access_arguments untuk halaman saat ini.
/**
* Show access permission of current page.
*/
function yourmodule_get_page_access() {
$router_item = menu_get_item();
if ($router_item) {
$access_arguments = unserialize($router_item['access_arguments']);
$arguments = array();
foreach ($access_arguments as $access_argument) {
$arguments[] = $access_argument;
}
if ($arguments) {
$output = '<p>';
$output .= t('This page needs user to have %p permission(s) to access', array(
'%p' => implode(', ', $arguments),
));
$output .= '</p>';
}
else {
$output = '<p>' . t('This page needs no user permissions') . ' </p>';
}
return $output;
}
}
Kemudian Anda dapat hook_page_alter, untuk menampilkan info akses di atas setiap halaman.
/**
* Implements hook_page_alter().
*
* Display access information on top of every page.
*/
function yourmodule_page_alter(&$page) {
// Make a new area on top of the page for displaying access information.
$page['content']['theverytop']['#markup'] = yourmodule_get_page_access();
$page['content']['theverytop']['#weight'] = -10;
$page['content']['#sorted'] = FALSE;
}
Selanjutnya Anda dapat menampilkan info izin blokir seperti ini:
/**
* Implement hook_block_alter
*
* To display block permission information to the block title.
*/
function yourmodule_block_view_alter(&$data, $block) {
$delta = $block->delta;
$output = '';
$rid = db_query("SELECT rid FROM {block_role} WHERE delta = :delta", array(':delta' => $delta))->fetchCol();
if (empty($rid)) {
$output = ' This block does not have any role permission restriction.';
} else {
$output = ' This block is viewable for users have role(s): ';
foreach ($rid as $role_id) {
$rolename = db_query("SELECT name from {role} where rid = :rid", array(':rid' => $role_id))->fetchField();
$output .= $rolename . ' ';
}
}
// append the permission info to block title for every block
$block->title .= $output;
}
Dan seterusnya, pada dasarnya konsep yang sama, Anda dapat melakukan hal yang sama untuk simpul, bentuk, pandangan. Semoga ini membantu.