if (!isset($config->groupecreators))
{$config->groupecreators = ''; }
if (!isset($config->removeuser))
- {$config->removeuser = 0; }
+ {$config->removeuser = AUTH_REMOVEUSER_KEEP; }
// save CAS settings
set_config('hostname', $config->hostname, 'auth/cas');
set_config('port', $config->port, 'auth/cas');
if (!empty($remove_users)) {
print "User entries to remove: ". count($remove_users) . "\n";
foreach ($remove_users as $user) {
- if ($this->config->removeuser == 2) {
+ if ($this->config->removeuser == AUTH_REMOVEUSER_FULLDELETE) {
if (delete_user($user)) {
echo "\t"; print_string('auth_dbdeleteuser', 'auth', array($user->username, $user->id)); echo "\n";
} else {
echo "\t"; print_string('auth_dbdeleteusererror', 'auth', $user->username); echo "\n";
}
- } else if ($this->config->removeuser == 1) {
+ } else if ($this->config->removeuser == AUTH_REMOVEUSER_SUSPEND) {
$updateuser = new object();
$updateuser->id = $user->id;
$updateuser->auth = 'nologin';
unset($remove_users); // free mem!
}
/// Revive suspended users
- if (!empty($this->config->removeuser) and $this->config->removeuser == 1) {
+ if (!empty($this->config->removeuser) and $this->config->removeuser == AUTH_REMOVEUSER_SUSPEND) {
$sql = "SELECT u.id, u.username
FROM $temptable e, {$CFG->prefix}user u
WHERE e.username=u.username
if (!isset($config->removeuser))
- {$config->removeuser = 0; }
+ {$config->removeuser = AUTH_REMOVEUSER_KEEP; }
$deleteopt = array();
- $deleteopt['0'] = get_string('auth_remove_keep','auth');
+ $deleteopt[AUTH_REMOVEUSER_KEEP] = get_string('auth_remove_keep','auth');
- $deleteopt['1'] = get_string('auth_remove_suspend','auth');
+ $deleteopt[AUTH_REMOVEUSER_SUSPEND] = get_string('auth_remove_suspend','auth');
- $deleteopt['2'] = get_string('auth_remove_delete','auth');
+ $deleteopt[AUTH_REMOVEUSER_FULLDELETE] = get_string('auth_remove_delete','auth');
choose_from_menu($deleteopt, 'removeuser', $config->removeuser, '');
?>
-</table>
\ No newline at end of file
+</table>
print_string('auth_dbuserstoremove','auth', count($remove_users)); echo "\n";
foreach ($remove_users as $user) {
- if ($this->config->removeuser == 2) {
+ if ($this->config->removeuser == AUTH_REMOVEUSER_FULLDELETE) {
if (delete_user($user)) {
echo "\t"; print_string('auth_dbdeleteuser', 'auth', array($user->username, $user->id)); echo "\n";
} else {
echo "\t"; print_string('auth_dbdeleteusererror', 'auth', $user->username); echo "\n";
}
- } else if ($this->config->removeuser == 1) {
+ } else if ($this->config->removeuser == AUTH_REMOVEUSER_SUSPEND) {
$updateuser = new object();
$updateuser->id = $user->id;
$updateuser->auth = 'nologin';
$config->debugauthdb = 0;
}
if (!isset($config->removeuser)) {
- $config->removeuser = 0;
+ $config->removeuser = AUTH_REMOVEUSER_KEEP;
}
if (!isset($config->changepasswordurl)) {
$config->changepasswordurl = '';
$config->setupsql = '';
}
if (!isset($config->removeuser)) {
- $config->removeuser = 0;
+ $config->removeuser = AUTH_REMOVEUSER_KEEP;
}
$yesno = array( get_string('no'), get_string('yes') );
<td>
<?php
$deleteopt = array();
- $deleteopt['0'] = get_string('auth_remove_keep','auth');
- $deleteopt['1'] = get_string('auth_remove_suspend','auth');
- $deleteopt['2'] = get_string('auth_remove_delete','auth');
+ $deleteopt[AUTH_REMOVEUSER_KEEP] = get_string('auth_remove_keep','auth');
+ $deleteopt[AUTH_REMOVEUSER_SUSPEND] = get_string('auth_remove_suspend','auth');
+ $deleteopt[AUTH_REMOVEUSER_FULLDELETE] = get_string('auth_remove_delete','auth');
choose_from_menu($deleteopt, 'removeuser', $config->removeuser, '');
?>
</td>
print "User entries to remove: ". count($remove_users) . "\n";
foreach ($remove_users as $user) {
- if ($this->config->removeuser == 2) {
+ if ($this->config->removeuser == AUTH_REMOVEUSER_FULLDELETE) {
if (delete_user($user)) {
echo "\t"; print_string('auth_dbdeleteuser', 'auth', array($user->username, $user->id)); echo "\n";
} else {
echo "\t"; print_string('auth_dbdeleteusererror', 'auth', $user->username); echo "\n";
}
- } else if ($this->config->removeuser == 1) {
+ } else if ($this->config->removeuser == AUTH_REMOVEUSER_SUSPEND) {
$updateuser = new object();
$updateuser->id = $user->id;
$updateuser->auth = 'nologin';
}
/// Revive suspended users
- if (!empty($this->config->removeuser) and $this->config->removeuser == 1) {
+ if (!empty($this->config->removeuser) and $this->config->removeuser == AUTH_REMOVEUSER_SUSPEND) {
$sql = "SELECT u.id, u.username
FROM $temptable e, {$CFG->prefix}user u
WHERE e.username=u.username
if (!isset($config->changepasswordurl))
{$config->changepasswordurl = ''; }
if (!isset($config->removeuser))
- {$config->removeuser = 0; }
+ {$config->removeuser = AUTH_REMOVEUSER_KEEP; }
if (!isset($config->ntlmsso_enabled))
{$config->ntlmsso_enabled = 0; }
if (!isset($config->ntlmsso_subnet))
if (!isset($config->changepasswordurl))
{$config->changepasswordurl = ''; }
if (!isset($config->removeuser))
- {$config->removeuser = 0; }
+ {$config->removeuser = AUTH_REMOVEUSER_KEEP; }
if (!isset($config->ntlmsso_enabled))
{$config->ntlmsso_enabled = 0; }
if (!isset($config->ntlmsso_subnet))
<td>
<?php
$deleteopt = array();
- $deleteopt['0'] = get_string('auth_remove_keep','auth');
- $deleteopt['1'] = get_string('auth_remove_suspend','auth');
- $deleteopt['2'] = get_string('auth_remove_delete','auth');
+ $deleteopt[AUTH_REMOVEUSER_KEEP] = get_string('auth_remove_keep','auth');
+ $deleteopt[AUTH_REMOVEUSER_SUSPEND] = get_string('auth_remove_suspend','auth');
+ $deleteopt[AUTH_REMOVEUSER_FULLDELETE] = get_string('auth_remove_delete','auth');
choose_from_menu($deleteopt, 'removeuser', $config->removeuser, '');
?>
</td>
define('AUTH_CONFIRM_ALREADY', 2);
define('AUTH_CONFIRM_ERROR', 3);
-
+# MDL-14055
+define('AUTH_REMOVEUSER_KEEP', 0);
+define('AUTH_REMOVEUSER_SUSPEND', 1);
+define('AUTH_REMOVEUSER_FULLDELETE', 2);
/**
* Abstract authentication plugin.