You are here

function _systeminfo_admin_drupal_roles in System Information 7.3

Same name and namespace in other branches
  1. 6.3 systeminfo.admin.drupal.inc \_systeminfo_admin_drupal_roles()
1 call to _systeminfo_admin_drupal_roles()
systeminfo_admin_drupal in ./systeminfo.admin.drupal.inc
Menu callback; displays the Drupal page.

File

./systeminfo.admin.drupal.inc, line 114
Admin Drupal page callbacks for the systeminfo module.

Code

function _systeminfo_admin_drupal_roles() {
  $header = array();
  $header[] = t('Group');
  $header[] = t('Permissions');
  $perms = array();
  $result = db_query('SELECT r.name, rp.permission, rp.module FROM {role_permission} rp LEFT JOIN {role} r ON r.rid = rp.rid ORDER BY r.weight, r.name');
  foreach ($result as $record) {
    if ($permissions = module_invoke($record->module, 'permission')) {
      $perms[$record->name][] = !empty($permissions[$record->permission]['title']) ? $permissions[$record->permission]['title'] : $record->permission;
    }
  }
  $rows = array();
  foreach ($perms as $role => $perm) {
    asort($perm);
    $row = array();
    $row[] = check_plain($role);
    $row[] = theme('item_list', array(
      'items' => $perm,
    ));
    $rows[] = $row;
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'class' => array(
        'systeminfo',
        'systeminfo-width50',
      ),
    ),
  ));
}