Merge pull request #7090 from JakubOnderka/fix-saving-log

fix: [internal] Correctly save log
pull/7095/head
Jakub Onderka 2021-02-25 12:26:56 +01:00 committed by GitHub
commit 38f785ea63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -605,18 +605,18 @@ class SharingGroup extends AppModel
$authorisedToSave = $this->checkIfAuthorisedToSave($user, $sg); $authorisedToSave = $this->checkIfAuthorisedToSave($user, $sg);
} }
if (!$user['Role']['perm_site_admin'] && if (!$user['Role']['perm_site_admin'] &&
!($user['Role']['perm_sync'] && $syncLocal ) && !($user['Role']['perm_sync'] && $syncLocal) &&
!$authorisedToSave !$authorisedToSave
) { ) {
$this->Log->create(); $this->Log->create();
$entry = array( $entry = array(
'org' => $user['Organisation']['name'], 'org' => $user['Organisation']['name'],
'model' => 'SharingGroup', 'model' => 'SharingGroup',
'model_id' => $sg['SharingGroup']['uuid'], 'model_id' => 0,
'email' => $user['email'], 'email' => $user['email'],
'action' => 'error', 'action' => 'error',
'user_id' => $user['id'], 'user_id' => $user['id'],
'title' => 'Tried to save a sharing group but the user does not belong to it.' 'title' => "Tried to save a sharing group with UUID '{$sg['SharingGroup']['uuid']}' but the user does not belong to it."
); );
$this->Log->save($entry); $this->Log->save($entry);
return false; return false;