fix: [permissionLimitations] Prevent error for org without users

develop-unstable
Sami Mokaddem 2023-01-17 09:23:24 +01:00
parent 2a754160ef
commit d9df6ed4c3
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 8 additions and 5 deletions

View File

@ -63,12 +63,15 @@ class PermissionLimitationsTable extends AppTable
])->count();
}
if (isset($data['global'])) {
$conditions = [
'scope' => 'user',
'field' => $field,
];
if (!empty($ownOrgUserIds)) {
$conditions['parent_id IN'] = array_values($ownOrgUserIds);
}
$limitations[$field]['organisation']['current'] = $MetaFields->find('all', [
'conditions' => [
'scope' => 'user',
'field' => $field,
'parent_id IN' => array_values($ownOrgUserIds)
]
'conditions' => $conditions,
])->count();
}
}