Commit 19addd7b authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't deactivate the root user



This user is handled as a special case almost everywhere, and
shouldn't be activated/deactivated, sent warning emails.

Change-Id: I0bc0ee35fde1cb20229c37f2e3b824b29c106db4
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 4e748611
......@@ -1492,7 +1492,7 @@ function auth_handle_account_expiries() {
FROM {usr} u
WHERE $lastactive + $dbexpire < current_timestamp + $dbwarn
AND (u.expiry IS NULL OR u.expiry > current_timestamp)
AND inactivemailsent = 0 AND deleted = 0", array($installationtime))) {
AND inactivemailsent = 0 AND deleted = 0 AND id > 0", array($installationtime))) {
foreach ($users as $user) {
$displayname = display_name($user);
_email_or_notify($user, get_string('accountinactivewarning'),
......@@ -1508,7 +1508,7 @@ function auth_handle_account_expiries() {
SELECT u.id
FROM {usr} u
WHERE $lastactive + $dbexpire < current_timestamp
AND (u.expiry IS NULL OR u.expiry > current_timestamp)", array($installationtime))) {
AND (u.expiry IS NULL OR u.expiry > current_timestamp) AND id > 0", array($installationtime))) {
// Users have become inactive!
foreach ($users as $user) {
deactivate_user($user->id);
......@@ -1819,6 +1819,14 @@ class PluginAuth extends Plugin {
}
public static function update_active_flag($event, $user) {
if (!isset($user['id'])) {
log_warn("update_active_flag called without a user id");
}
if ($user['id'] === 0 || $user['id'] === '0') {
return;
}
$active = true;
// ensure we have everything we need
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment