Permalink
Browse files

MDL-20933 fixed a regression, we should not force changing of passwor…

…d for admins that can not actually change the password
  • Loading branch information...
1 parent 89d1fd9 commit 847f077e39dd7deda8aedef064727faff1013892 @skodak skodak committed Nov 22, 2009
Showing with 3 additions and 2 deletions.
  1. +2 −1 lib/db/upgrade.php
  2. +1 −1 version.php
View
@@ -846,14 +846,15 @@ function xmldb_main_upgrade($oldversion=0) {
if ($result && $oldversion < 2007021599.14) {
// this block tries to undo incorrect forcing of new passwords for admins that have no
// way to change passwords MDL-20933
+ $systemcontext = get_context_instance(CONTEXT_SYSTEM);
$sql = "SELECT DISTINCT u.id, u.firstname, u.lastname, u.picture, u.imagealt, u.email, u.password, u.auth
FROM {$CFG->prefix}role_capabilities rc
JOIN {$CFG->prefix}role_assignments ra ON (ra.contextid = rc.contextid AND ra.roleid = rc.roleid)
JOIN {$CFG->prefix}user u ON u.id = ra.userid
WHERE rc.capability = 'moodle/site:doanything'
AND rc.permission = ".CAP_ALLOW."
AND u.deleted = 0
- AND rc.contextid = ".SYSCONTEXTID."";
+ AND rc.contextid = ".$systemcontext->id."";
$adminusers = get_records_sql($sql);
foreach ($adminusers as $adminuser) {
View
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2007021599.13; // YYYYMMDD = date of the 1.8 branch (don't change)
+ $version = 2007021599.14; // YYYYMMDD = date of the 1.8 branch (don't change)
// 99 = we reached a .10 release! (don't change)
// .XX = release number 1.8.[10,11,12,..]

0 comments on commit 847f077

Please sign in to comment.