Skip to content

Instantly share code, notes, and snippets.

@mbrooks
Created March 11, 2013 22:14
Show Gist options
  • Save mbrooks/5138368 to your computer and use it in GitHub Desktop.
Save mbrooks/5138368 to your computer and use it in GitHub Desktop.
<?php
/**
* Import Drupal Users to Drupal SAML Users
* Works with the SimpleSAMLphp Auth Drupal Module
* By: Matt Brooks
* Email: matt@msbrooks.com
*/
function import_saml_users(){
$result = db_query("SELECT * FROM {users}");
foreach(
$result as $record ) {
$nid = db_insert('authmap')
->fields(array(
'uid' => $record->uid,
'authname' => $record->name,
'module' => 'simplesamlphp_auth'
))
->execute();
}
return
'finish import SAML users!';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment