fix: [logging] fixed using removeTagFromObject()

- no longer creates erroneous log entries when unpublishing the event
pull/9613/head
iglocska 2024-03-06 10:39:55 +01:00
parent 6a2986be6a
commit dc0cb15675
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 22 additions and 0 deletions

View File

@ -820,6 +820,15 @@ class TagsController extends AppController
}
$message = 'Global tag ' . $existingTag['Tag']['name'] . '(' . $existingTag['Tag']['id'] . ') successfully attached to ' . $objectType . '(' . $object[$objectType]['id'] . ').';
}
$this->loadModel('Log');
$this->Log->createLogEntry(
$this->Auth->user(),
'attachTagToObject',
$objectType,
$object[$objectType]['id'],
$message,
null
);
$successes++;
} else {
$fails[] = __('Failed to attach tag to object.');
@ -896,6 +905,17 @@ class TagsController extends AppController
$result = $this->$objectType->$connectorObject->delete($existingAssociation[$connectorObject]['id']);
if ($result) {
$message = __('%s tag %s (%s) successfully removed from %s(%s).', $local ? __('Local') : __('Global'), $existingTag['Tag']['name'], $existingTag['Tag']['id'], $objectType, $object[$objectType]['id']);
$this->loadModel('Log');
$this->Log->createLogEntry(
$this->Auth->user(),
'removeTagFromObject',
$objectType,
$object[$objectType]['id'],
$message,
__(
'',
)
);
if (!$local) {
if ($objectType === 'Attribute') {
$this->Attribute->touch($object['Attribute']['id']);

View File

@ -38,6 +38,7 @@ class Log extends AppModel
'add',
'admin_email',
'attachTags',
'attachTagToObject',
'auth',
'auth_fail',
'auth_alert',
@ -78,6 +79,7 @@ class Log extends AppModel
'registration',
'registration_error',
'remove_dead_workers',
'removeTagFromObject',
'request',
'request_delegation',
'reset_auth_key',