From c9e0a29ebac5a451460de5b45efb90813a7cb68b Mon Sep 17 00:00:00 2001 From: Stevani Andolo Date: Tue, 9 Apr 2024 17:32:35 +0800 Subject: [PATCH] MDL-81476 admin_reportbuilder: Fixed user list page This is basically just bringing back the same check done prior to MDL-79270 where if there is no data being returned the default value for the accessctr would be "allow". --- .../reportbuilder/local/systemreports/users.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/admin/classes/reportbuilder/local/systemreports/users.php b/admin/classes/reportbuilder/local/systemreports/users.php index 28fde601b0c..f1dba3de83e 100644 --- a/admin/classes/reportbuilder/local/systemreports/users.php +++ b/admin/classes/reportbuilder/local/systemreports/users.php @@ -317,9 +317,14 @@ class users extends system_report { false, new lang_string('denyaccess', 'mnet'), ))->add_callback(static function(\stdclass $row) use ($DB, $contextsystem): bool { - $acl = $DB->get_record('mnet_sso_access_control', ['username' => $row->username, 'mnet_host_id' => $row->mnethostid]); + if (!$accessctrl = $DB->get_field(table: 'mnet_sso_access_control', return: 'accessctrl', + conditions: ['username' => $row->username, 'mnet_host_id' => $row->mnethostid] + )) { + $accessctrl = 'allow'; + } + return has_capability('moodle/user:update', $contextsystem) && !$row->suspended && - is_mnet_remote_user($row) && $acl->accessctrl == 'allow'; + is_mnet_remote_user($row) && $accessctrl == 'allow'; })); // Action to unsuspend users (mnet remote users). @@ -330,9 +335,14 @@ class users extends system_report { false, new lang_string('allowaccess', 'mnet'), ))->add_callback(static function(\stdclass $row) use ($DB, $contextsystem): bool { - $acl = $DB->get_record('mnet_sso_access_control', ['username' => $row->username, 'mnet_host_id' => $row->mnethostid]); + if (!$accessctrl = $DB->get_field(table: 'mnet_sso_access_control', return: 'accessctrl', + conditions: ['username' => $row->username, 'mnet_host_id' => $row->mnethostid] + )) { + $accessctrl = 'allow'; + } + return has_capability('moodle/user:update', $contextsystem) && !$row->suspended && - is_mnet_remote_user($row) && $acl->accessctrl == 'deny'; + is_mnet_remote_user($row) && $accessctrl == 'deny'; })); // Action to delete users. -- 2.11.4.GIT