You are here

function _shib_auth_list_rules in Shibboleth Authentication 6.3

Same name and namespace in other branches
  1. 6.4 shib_auth_roles_forms.inc \_shib_auth_list_rules()
  2. 7.4 shib_auth_roles_forms.inc \_shib_auth_list_rules()

This function lists all rules, and let the admin to do certain actions with them @returns HTML table containing the attribute, RegExp, role and the actions, which can be done with each role

1 string reference to '_shib_auth_list_rules'
shib_auth_menu in ./shib_auth.module
Generate the menu element to access the Shibboleth authentication module's administration page @returns HTML text of the administer menu element

File

./shib_auth.module, line 634
This is a Shibboleth authentication module.

Code

function _shib_auth_list_rules() {
  $rules = db_query("SELECT * FROM {shib_auth}");
  $retval = '<table style="width: 100%;"><tr><th>Attribute</th><th>RegExp</th><th>Role(s)</th><th>Actions</th></tr>' . "\n";
  $counter = 0;
  while ($rule = db_fetch_array($rules)) {
    $roles = unserialize(urldecode($rule['role']));
    $roles_list = '';
    if (!empty($roles)) {
      $roles_list = implode(', ', $roles);
    }
    $retval .= '<tr><td>' . $rule['field'] . '</td><td>' . urldecode($rule['regexpression']) . '</td><td>' . $roles_list . '</td>';
    $retval .= '<td stype="text-align: right;">';
    $retval .= '<a href="' . url('admin/user/shib_auth/clone/' . $rule['id']) . '">' . t('Clone') . '</a> | ';
    $retval .= '<a href="' . url('admin/user/shib_auth/edit/' . $rule['id']) . '">' . t('Edit') . '</a> | ';
    $retval .= '<a href="' . url('admin/user/shib_auth/delete/' . $rule['id']) . '">' . t('Delete') . '</a>';
    $retval .= '</td></tr>' . "\n";
    $counter++;
  }
  if ($counter == 0) {
    $retval .= '<tr><td colspan="4" stype="text-align: center;">';
    $retval .= t('There is no rule in the database') . '</td></tr>' . "\n";
  }
  $retval .= '</table>';
  return $retval;
}