You are here

function _shib_auth_clone_rule in Shibboleth Authentication 6.3

This function enables the administrator to clone an existing rule, this is useful, when we want to create a rule, which is simiral to another one

Parameters

id rule identifier:

1 string reference to '_shib_auth_clone_rule'
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.module, line 611
This is a Shibboleth authentication module.

Code

function _shib_auth_clone_rule($id) {
  $rule = db_query("SELECT * FROM {shib_auth} WHERE id = %d", array(
    $id,
  ));
  $db_entry = db_fetch_array($rule);
  $db_entry['id'] = NULL;
  $update = array();
  $ret = drupal_write_record('shib_auth', $db_entry, $update);
  if ($ret = SAVED_NEW) {
    drupal_set_message('The rule has been successfulliy cloned.');
  }
  else {
    drupal_set_message('Unexpected error has been detected.');
  }
  drupal_goto('admin/user/shib_auth/rules');
}