Reviewed:  https://reviews.mahara.org/11361
Committed: 
https://git.mahara.org/mahara/mahara/commit/9e1aaeeab2109ef7bdfccb6a95165ab8cef0a50c
Submitter: Robert Lyon (robe...@catalyst.net.nz)
Branch:    master

commit 9e1aaeeab2109ef7bdfccb6a95165ab8cef0a50c
Author: Mitsuhiro Yoshida <m...@mitstek.com>
Date:   Tue Oct 13 13:24:12 2020 +0900

Bug 1899571: Avoid suspending all site admins or suspending oneself

Duplicated the delete validation code so that we cannot
1) suspend all the site admin users
2) suspend ourself (either site or institutional admin)

Change-Id: I4ce55ca55281f641ff1a24cfed567344ca851305

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask 
on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1899571

Title:
  The only site admin can suspend the account by oneself

Status in Mahara:
  Fix Committed
Status in Mahara 20.10 series:
  Fix Committed

Bug description:
  Now the only site admin can suspend the account by oneself and be locked out 
from the site.
  So I think it's better for us to avoid site admins suspending oneself by 
changing code as below.

  File to modify:
  admin/users/bulk.php

  Line:
  294

  [ Before ]
      db_begin();

      foreach ($users as $user) {
          if (!$user->suspendedcusr) {
              suspend_user($user->id, $values['reason']);
              $suspended++;
          }
      }

      db_commit();

      $SESSION->add_ok_msg(get_string('bulksuspenduserssuccess', 'admin', 
$suspended));
      redirect('/admin/users/suspended.php');

  [ After ]
      db_begin();

      foreach ($users as $user) {
          if (!$user->suspendedcusr && !get_record('usr', 'id', $user->id, 
'admin', '1')) {
              suspend_user($user->id, $values['reason']);
              $suspended++;
          }
      }

      db_commit();

      $SESSION->add_ok_msg(get_string('bulksuspenduserssuccess', 'admin', 
$suspended));
      $SESSION->add_error_msg('You can\'t suspend site admins.');
      redirect('/admin/users/suspended.php');

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1899571/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : mahara-contributors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to