You are here

function shib_auth_edit_form in Shibboleth Authentication 6.3

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

Generate the shibboleth rule adding form

@returns the edit form, with the fields already filled in with the elements of the options array

Parameters

$options contains the data, we want to fill the form with:

2 calls to shib_auth_edit_form()
shib_auth_edit_rule in ./shib_auth.module
Edits an existing rule, containing he rule name, the server attrubite, the RegExp, and the role names
shib_auth_new_rule in ./shib_auth.module
Saves a new rule, containing he rule name, the server attrubite, the RegExp, and the role names

File

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

Code

function shib_auth_edit_form($options) {
  $form['shib_auth_new_id'] = array(
    '#title' => t('Entry id'),
    '#type' => 'hidden',
    '#default_value' => $options[0],
  );
  $form['shib_auth_new_attrib'] = array(
    '#title' => t('Shibboleth attribute name'),
    '#type' => 'textfield',
    '#default_value' => $options[1],
    '#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['shib_auth_new_regexp'] = array(
    '#title' => t('Value (regexp)'),
    '#type' => 'textfield',
    '#default_value' => $options[2],
    '#require' => TRUE,
  );
  $roles = user_roles(TRUE);
  $form['shib_auth_roles'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Roles'),
    '#default_value' => count($options[3]) > 1 || count($options[3]) == 1 && $options[3] != "" ? array_keys($options[3]) : array(),
    '#options' => $roles,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t($options[4]),
  );
  $form['#submit'][] = 'shib_auth_new_rule';
  return $form;
}