Skip to content

Commit

Permalink
access: allow root disable and prevent to disable own user
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Sep 19, 2016
1 parent 2f5468a commit d569a8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/etc/inc/auth.inc
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ function local_user_set(&$user)
/* root user special handling */
if ($user_uid == 0) {
$user_shell = isset($user['shell']) ? $user['shell'] : '/usr/local/etc/rc.initial';
$lock_account = 'unlock';
$user_group = 'wheel';
$user_home = '/root';
}
Expand Down
6 changes: 5 additions & 1 deletion src/www/system_usermanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ function get_user_privdesc(& $user)
$input_errors[] = gettext("The passwords do not match.");
}

if (!empty($pconfig['disabled']) && $_SESSION['Username'] === $a_user[$id]['name']) {
$input_errors[] = gettext('You cannot disable yourself.');
}

if (isset($id)) {
$oldusername = $a_user[$id]['name'];
} else {
Expand All @@ -262,7 +266,7 @@ function get_user_privdesc(& $user)
}
}

/*
/*
* Check for a valid expirationdate if one is set at all (valid means,
* DateTime puts out a time stamp so any DateTime compatible time
* format may be used. to keep it simple for the enduser, we only
Expand Down

0 comments on commit d569a8e

Please sign in to comment.