function _shib_auth_rule_clone_confirm_form_submit in Shibboleth Authentication 7.4
Same name and namespace in other branches
- 6.4 shib_auth_roles_forms.inc \_shib_auth_rule_clone_confirm_form_submit()
Enables the administrator to clone an existing rule.
This function enables the administrator to clone an existing rule, this is useful, when we want to create a rule, which is similar to another one.
File
- ./
shib_auth_roles_forms.inc, line 129 - Roles manager forms.
Code
function _shib_auth_rule_clone_confirm_form_submit($form, &$form_state) {
$id = $form_state['build_info']['args'][0];
if ($id = intval($id)) {
$rule = db_select('shib_auth', 'c')
->fields('c')
->condition('id', $id, '=')
->execute()
->fetchAssoc();
unset($rule['id']);
$ret = drupal_write_record('shib_auth', $rule);
if ($ret === SAVED_NEW) {
drupal_set_message(t('The rule has been successfully cloned.'));
}
else {
drupal_set_message(t('Unexpected error has been detected.'));
}
}
else {
drupal_set_message(t("Invalid rule id."), 'error');
}
drupal_goto('admin/config/people/shib_auth/rules');
}