function cas_drush_user_create in CAS 6.3
Same name and namespace in other branches
- 7 cas.drush.inc \cas_drush_user_create()
Creates a new CAS user account.
1 string reference to 'cas_drush_user_create'
- cas_drush_command in ./
cas.drush.inc - Implements hook_drush_command().
File
- ./
cas.drush.inc, line 55 - Drush commands for CAS.
Code
function cas_drush_user_create($cas_name) {
// @todo: Handle additional options for setting other user attributes.
$account = cas_user_load_by_name($cas_name);
if ($account === FALSE) {
if (!drush_get_context('DRUSH_SIMULATE')) {
$options = array(
'invoke_cas_user_presave' => TRUE,
);
$new_user_object = cas_user_register($cas_name, $options);
if ($new_user_object !== FALSE) {
_drush_user_print_info($new_user_object->uid);
// return $new_user_object->uid;
}
else {
drush_set_error(dt('Could not create a new user account with CAS username @cas_name.', array(
'@cas_name' => $cas_name,
)));
}
}
}
else {
drush_set_error(dt('There is already a user account with CAS username @cas_name.', array(
'@cas_name' => $cas_name,
)));
}
}