Commit 8787c9f8 authored by Robert Lyon's avatar Robert Lyon

Bug 717196: Fixing user search problem for no institution

behatnotneeded

Change-Id: Ied77db9958413d8fd6f4c36d02856dd04ca9797c
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent a1a13e33
......@@ -3416,7 +3416,8 @@ function isolatedinstitution_access($userid, $currentuserid = null) {
$userobj->find_by_id($userid);
$userinsts = array_keys($userobj->get('institutions'));
$loggedininsts = array_keys($user->get('institutions'));
if (!$userobj->get('admin') && empty(array_intersect($userinsts, $loggedininsts))) {
$ok = (empty($userinsts) && empty($loggedininsts)) ? true : false; // both users in 'mahara'
if (!$userobj->get('admin') && !$ok && empty(array_intersect($userinsts, $loggedininsts))) {
throw new AccessDeniedException(get_string('notinthesameinstitution', 'error'));
}
else {
......
......@@ -133,7 +133,7 @@ class PluginSearchInternal extends PluginSearch {
. ' UNION SELECT usr2 FROM {usr_friend} f2 WHERE f2.usr1 = ' . $USER->get('id') . ')';
}
if ((!empty($data['myinstitutions']) && !empty($data['institutions'])) || is_isolated()) {
if ((!empty($data['myinstitutions']) && !empty($data['institutions'])) || (is_isolated() && !empty($data['institutions']))) {
$where .= '
AND (u.id IN (
SELECT usr FROM {usr_institution} WHERE institution IN ('
......
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