You are here

function simplesamlphp_auth_install in simpleSAMLphp Authentication 6.2

Same name and namespace in other branches
  1. 8.3 simplesamlphp_auth.install \simplesamlphp_auth_install()
  2. 6.3 simplesamlphp_auth.install \simplesamlphp_auth_install()
  3. 7.3 simplesamlphp_auth.install \simplesamlphp_auth_install()
  4. 7 simplesamlphp_auth.install \simplesamlphp_auth_install()
  5. 7.2 simplesamlphp_auth.install \simplesamlphp_auth_install()

Implementation of hook_install().

File

./simplesamlphp_auth.install, line 11
the install file for the simplesamlphp_auth module

Code

function simplesamlphp_auth_install() {
  $abc = 'test';

  // Necessary userprotect settings
  $query1 = db_result(db_query('SELECT perm FROM {permission} WHERE rid = 2'));
  if ($query1) {
    $new_perms = str_replace(", change own password", "", $query1);
    $new_perms = str_replace("change own password", "", $new_perms);
    $query2 = db_query("UPDATE {permission} SET perm = '" . $new_perms . "' WHERE rid = 2");
  }

  //Hide Login block by default

  //$query3 = db_query("UPDATE {blocks} SET status='0' WHERE module='user' AND delta='0'");

  //Remove Logout from the menu by default

  //$query4 = db_query("UPDATE {menu} SET type=48 WHERE path='logout'");

  //Disable the open registration to the site and store the original setting.
  $original = variable_get("user_register", "1");
  variable_set("user_register", "0");
  variable_set("simplesamlphp_auth_user_register_original", $original);
  if ($query1) {
    drupal_set_message('The simpleSAMLphp authentication module was installed successfully.');
  }
  else {
    drupal_set_message('There was an error installing the simpleSAMLphp authentication database tables.', 'error');
  }
}