Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Other admins cannot edit the primary admin account

  • Loading branch information...
commit 04981917cde234832757be7346083dac4473808e 1 parent 24977f8
moodler authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 user/edit.php
View
13 user/edit.php
@@ -39,8 +39,16 @@
require_login($course->id);
}
- if (($USER->id <> $user->id) && !isadmin()) {
- error("You can only edit your own information");
+ if ($USER->id <> $user->id) { // Current user editing someone else's profile
+ if (isadmin()) { // Current user is an admin
+ if ($mainadmin = get_admin()) {
+ if ($user->id == $mainadmin->id) { // Can't edit primary admin
+ print_error('adminprimarynoedit');
+ }
+ }
+ } else {
+ print_error('onlyeditown');
+ }
}
if (isguest()) {
@@ -51,6 +59,7 @@
error("Sorry, the guest user cannot be edited.");
}
+
// load the relevant auth libraries
if ($user->auth) {
$auth = $user->auth;
Please sign in to comment.
Something went wrong with that request. Please try again.