Permalink
Browse files

Other admins cannot edit the primary admin account

  • Loading branch information...
1 parent 24977f8 commit 04981917cde234832757be7346083dac4473808e moodler committed Mar 18, 2005
Showing with 11 additions and 2 deletions.
  1. +11 −2 user/edit.php
View
@@ -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;

0 comments on commit 0498191

Please sign in to comment.