function _shib_auth_list_rules in Shibboleth Authentication 6.4
Same name and namespace in other branches
- 6.3 shib_auth.module \_shib_auth_list_rules()
- 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 number of rule, 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_roles_forms.inc, line 141 - Roles manager forms.
Code
function _shib_auth_list_rules() {
$output = NULL;
$rows = array();
// if the admin is not logged in through shibboleth, rolename cache have to be generated
shib_auth_generate_rolenames(TRUE);
//create rows
$rules = db_query("SELECT * FROM {shib_auth}");
while ($rule = db_fetch_array($rules)) {
$roles = unserialize($rule['role']);
$roles_list = '';
foreach ($roles as $role) {
if (!empty($role)) {
$roles_list .= shib_auth_get_rolename($role) . ', ';
}
}
//cut off the last ', ' charaters
$roles_list = drupal_substr($roles_list, 0, -2);
$rule['sticky'] == 1 ? $sticky = 'Yes' : ($sticky = 'No');
$rows[] = array(
$rule['field'],
urldecode($rule['regexpression']),
$roles_list,
$sticky,
l(t('Clone'), 'admin/user/shib_auth/clone/' . $rule['id']) . ' | ' . l(t('Edit'), 'admin/user/shib_auth/edit/' . $rule['id']) . ' | ' . l(t('Delete'), 'admin/user/shib_auth/delete/' . $rule['id']),
);
}
//create the rule list in HTML table
$header = array(
t('Attribute'),
t('RegExp'),
t('Roles'),
t('Sticky'),
t('Actions'),
);
$output = theme_table($header, $rows);
if (empty($rows)) {
$output .= t('There is no rule in the database<br/>');
}
$output .= l(t('Add new rule'), 'admin/user/shib_auth/new');
return $output;
}