Commit 6c531e5a authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Reload user institutions from db on institutional admin pages (bug #494484 -...


Reload user institutions from db on institutional admin pages (bug #494484 - thanks to Ruslan Kabalin)
Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent f4544c13
...@@ -395,13 +395,7 @@ function auth_setup () { ...@@ -395,13 +395,7 @@ function auth_setup () {
redirect(); redirect();
} }
} else if (defined('INSTITUTIONALADMIN') && !$USER->get('admin')) { } else if (defined('INSTITUTIONALADMIN') && !$USER->get('admin')) {
$userreallyadminfor = get_column('usr_institution', 'institution', 'usr', $USER->id, 'admin', 1); $USER->reset_institutions();
if (!$USER->is_institutional_admin() && !empty($userreallyadminfor)) {
$USER->set_admin_institutions($userreallyadminfor);
}
else if ($USER->is_institutional_admin() && empty($userreallyadminfor)) {
$USER->set_admin_institutions(array());
}
if (!$USER->is_institutional_admin()) { if (!$USER->is_institutional_admin()) {
$SESSION->add_error_msg(get_string('accessforbiddentoadminsection')); $SESSION->add_error_msg(get_string('accessforbiddentoadminsection'));
redirect(); redirect();
......
...@@ -623,14 +623,6 @@ class User { ...@@ -623,14 +623,6 @@ class User {
return false; return false;
} }
public function set_admin_institutions($institutions) {
if (empty($institutions)) {
$this->set('admininstitutions', array());
} else {
$this->set('admininstitutions', array_combine($institutions, $institutions));
}
}
public function add_institution_request($institution, $studentid = null) { public function add_institution_request($institution, $studentid = null) {
if (empty($institution) || $institution == 'mahara') { if (empty($institution) || $institution == 'mahara') {
return; return;
...@@ -640,7 +632,7 @@ class User { ...@@ -640,7 +632,7 @@ class User {
$institution->addRequestFromUser($this, $studentid); $institution->addRequestFromUser($this, $studentid);
} }
protected function reset_institutions() { public function reset_institutions() {
$institutions = load_user_institutions($this->id); $institutions = load_user_institutions($this->id);
$admininstitutions = array(); $admininstitutions = array();
$staffinstitutions = array(); $staffinstitutions = array();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment