chg: [event:publish] Reverse condition for readability and consistency with _add

feature/publication-blocking-same-user
Sami Mokaddem 2023-12-18 11:53:32 +01:00
parent 1389150069
commit 446620fad6
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 2 additions and 2 deletions

View File

@ -4083,8 +4083,8 @@ class Event extends AppModel
return array('error' => 'Event could not be saved: Could not find the local event.');
}
if (
(!empty($data['Event']['published']) && !$user['Role']['perm_publish']) ||
(Configure::read('MISP.block_publishing_for_same_creator', false) && $user['id'] == $existingEvent['Event']['user_id'] && !$user['Role']['perm_sync'])
(Configure::read('MISP.block_publishing_for_same_creator', false) && !$user['Role']['perm_sync'] && $user['id'] == $existingEvent['Event']['user_id']) ||
(!empty($data['Event']['published']) && !$user['Role']['perm_publish'])
) {
$data['Event']['published'] = 0;
}