Same name and namespace in other branches
  1. 4.7.x modules/user.module \user_admin_access()
  2. 5.x modules/user/user.module \user_admin_access()
  3. 6.x modules/user/user.admin.inc \user_admin_access()

Menu callback: list all access rules

1 string reference to 'user_admin_access'
user_menu in modules/user.module
Implementation of hook_menu().

File

modules/user.module, line 1465
Enables the user registration and login system.

Code

function user_admin_access() {
  $header = array(
    array(
      'data' => t('Access type'),
      'field' => 'status',
    ),
    array(
      'data' => t('Rule type'),
      'field' => 'type',
    ),
    array(
      'data' => t('Mask'),
      'field' => 'mask',
    ),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $result = db_query("SELECT aid, type, status, mask FROM {access}" . tablesort_sql($header));
  $access_types = array(
    'user' => t('username'),
    'mail' => t('e-mail'),
  );
  $rows = array();
  while ($rule = db_fetch_object($result)) {
    $rows[] = array(
      $rule->status ? t('allow') : t('deny'),
      $access_types[$rule->type],
      $rule->mask,
      l(t('edit'), 'admin/access/rules/edit/' . $rule->aid),
      l(t('delete'), 'admin/access/rules/delete/' . $rule->aid),
    );
  }
  if (count($rows) == 0) {
    $rows[] = array(
      array(
        'data' => '<em>' . t('There are currently no access rules.') . '</em>',
        'colspan' => 5,
      ),
    );
  }
  $output .= theme('table', $header, $rows);
  print theme('page', $output);
}