You are here

function shib_auth_edit_form in Shibboleth Authentication 6.4

Same name and namespace in other branches
  1. 6.3 shib_auth.module \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_roles_forms.inc
Edits a rule by calling universal create/edit form
shib_auth_new_rule in ./shib_auth_roles_forms.inc
Creates a new rule by calling universal create/edit form

File

./shib_auth_roles_forms.inc, line 13
Roles manager forms.

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] != "" ? $options[3] : array(),
    '#options' => $roles,
  );
  $form['sticky_markup'] = array(
    '#value' => '<b>Role type:</b>',
  );
  $form['shib_auth_new_sticky'] = array(
    '#type' => 'checkbox',
    '#title' => t('Sticky'),
    '#default_value' => $options[5],
    '#description' => t('Set the rule to be sticky if you want to save the role(s) permanently to the user\'s profile.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t($options[4]),
  );
  return $form;
}