You are here

function shib_auth_new_rule_form in Shibboleth Authentication 5.3

Add a new rule form.

Parameters

$editing_rule: If edit or clone a rule it has value otherwise it is an empty array.

Return value

form API compatible array

1 call to shib_auth_new_rule_form()
shib_auth_edit_rule in ./shib_auth_admin.inc
Rule edit form basedon new rule form
1 string reference to 'shib_auth_new_rule_form'
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_admin.inc, line 188
Generate the administration form of the Shibboleth authentication module

Code

function shib_auth_new_rule_form($editing_rule = array()) {
  $form = array();
  $form['field'] = array(
    '#title' => t('Shibboleth attribute name'),
    '#type' => 'textfield',
    '#default_value' => !empty($editing_rule['field']) ? $editing_rule['field'] : '',
    '#require' => TRUE,
    '#description' => t('More properly: <b>$_SERVER</b> field name; enable DEBUG mode to list available fields. <br/>Note that it might differ from your users\' fields.'),
  );
  $form['regexpression'] = array(
    '#title' => t('Value (regexp)'),
    '#type' => 'textfield',
    '#default_value' => !empty($editing_rule['regexpression']) ? $editing_rule['regexpression'] : '',
    '#require' => TRUE,
  );
  $roles = user_roles(TRUE);
  $edit_role = unserialize($editing_rule['role']);
  $form['roles'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Roles'),
    '#default_value' => is_array($edit_role) ? array_keys($edit_role) : '',
    '#options' => $roles,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('@Action rule', array(
      '@Action' => arg(4),
    )),
  );

  //$form['#submit'][] = 'shib_auth_new_rule';
  return $form;
}