From 54aa24a31e54eec1ce3b16f516b51dca09dddbe6 Mon Sep 17 00:00:00 2001 From: Jakub Onderka Date: Wed, 12 Aug 2020 18:11:24 +0200 Subject: [PATCH] fix: [intrernal] Undefined index: Organisation notice --- app/Model/User.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Model/User.php b/app/Model/User.php index deed9f92c..893aef095 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -683,7 +683,6 @@ class User extends AppModel // parameters are an array of org IDs that are owners (for an event this would be orgc and org) public function getUsersWithAccess($owners = array(), $distribution, $sharing_group_id = 0, $userConditions = array()) { - $sgModel = ClassRegistry::init('SharingGroup'); $conditions = array(); $validOrgs = array(); $all = true; @@ -696,6 +695,7 @@ class User extends AppModel // add all orgs to the conditions that can see the SG if ($distribution == 4) { + $sgModel = ClassRegistry::init('SharingGroup'); $sgOrgs = $sgModel->getOrgsWithAccess($sharing_group_id); if ($sgOrgs === true) { $all = true; @@ -723,8 +723,8 @@ class User extends AppModel $users = $this->find('all', array( 'conditions' => $conditions, 'recursive' => -1, - 'fields' => array('id', 'email', 'gpgkey', 'certif_public', 'org_id'), - 'contain' => array('Role' => array('fields' => array('perm_site_admin'))), + 'fields' => array('id', 'email', 'gpgkey', 'certif_public', 'org_id', 'disabled'), + 'contain' => ['Role' => ['fields' => ['perm_site_admin']], 'Organisation' => ['fields' => ['id']]], )); foreach ($users as $k => $user) { $user = $user['User'];