You are here

function systeminfo_admin_drupal_roles in System Information 7.2

1 call to systeminfo_admin_drupal_roles()
systeminfo_admin_drupal in ./systeminfo.admin.drupal.inc
Menu callback; displays Drupal page.

File

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

Code

function systeminfo_admin_drupal_roles() {
  $header = array();
  $header[] = t('Name');
  $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][] = $permissions[$record->permission]['title'];
    }
  }
  $rows = array();
  foreach ($perms as $role => $perm) {
    asort($perm);
    $row = array();
    $row[] = $role;
    $row[] = theme('item_list', array(
      'items' => $perm,
    ));
    $rows[] = $row;
  }
  $output = '<h3>' . t('Roles') . '</h3>';
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'class' => array(
        'systeminfo',
        'systeminfo_width50',
      ),
    ),
  ));
  return $output;
}