fix: [event:__prepareForPushToServer] Slight refactoring

pull/7469/head
mokaddem 2021-06-04 15:22:06 +02:00
parent eee298f19f
commit bd26a1671c
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 11 additions and 13 deletions

View File

@ -1005,29 +1005,27 @@ class Event extends AppModel
{
if ($event['Event']['distribution'] == 4) {
if (empty($event['SharingGroup']['SharingGroup']['roaming']) && empty($server['Server']['internal'])) {
$found = false;
if (isset($event['SharingGroup']['SharingGroupServer']) && !empty($event['SharingGroup']['SharingGroupServer'])) {
foreach ($event['SharingGroup']['SharingGroupServer'] as $s) {
foreach ($event['SharingGroup']['SharingGroupServer'] as $sgs) {
if ($sgs['server_id'] == $server['Server']['id']) {
$found = true;
}
$serverFound = false;
if (!empty($event['SharingGroup']['SharingGroupServer'])) {
foreach ($event['SharingGroup']['SharingGroupServer'] as $sgs) {
if ($sgs['server_id'] == $server['Server']['id']) {
$serverFound = true;
}
}
}
if (!$found) {
if (!$serverFound) {
return 403;
}
}
$found = false;
if (isset($event['SharingGroup']['SharingGroupOrg']) && !empty($event['SharingGroup']['SharingGroupOrg'])) {
$orgFound = false;
if (!empty($event['SharingGroup']['SharingGroupOrg'])) {
foreach ($event['SharingGroup']['SharingGroupOrg'] as $org) {
if (isset($org['Organisation']) && $org['Organisation']['uuid'] === $server['RemoteOrg']['uuid']) {
$found = true;
$orgFound = true;
}
}
}
if (!$found) {
if (!$orgFound) {
return 403;
}
}

View File

@ -533,7 +533,7 @@ class SharingGroup extends AppModel
}
}
}
if ($conditional === false && !$server['Server']['internal']) {
if ($conditional === false && empty($server['Server']['internal'])) {
return false;
}
}