new: [audit log] behaviour tied into the appropriate models

pull/92/head
iglocska 2021-11-17 15:43:52 +01:00
parent 72bd564120
commit 2e1ee2d064
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
18 changed files with 26 additions and 10 deletions

View File

@ -12,6 +12,7 @@ class AlignmentsTable extends AppTable
{ {
parent::initialize($config); parent::initialize($config);
$this->belongsTo('Individuals'); $this->belongsTo('Individuals');
$this->addBehavior('AuditLog');
$this->belongsTo('Organisations'); $this->belongsTo('Organisations');
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
} }

View File

@ -145,7 +145,7 @@ class AuditLogsTable extends AppTable
} }
} }
if ($this->syslog) { if ($this->syslog) {
$entry = $data['action']; $entry = $data['request_action'];
$title = $entity->generateUserFriendlyTitle(); $title = $entity->generateUserFriendlyTitle();
if ($title) { if ($title) {
$entry .= " -- $title"; $entry .= " -- $title";

View File

@ -19,10 +19,11 @@ class AuthKeysTable extends AppTable
{ {
parent::initialize($config); parent::initialize($config);
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('AuditLog');
$this->belongsTo( $this->belongsTo(
'Users' 'Users'
); );
$this->setDisplayField('authkey'); $this->setDisplayField('comment');
} }
public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options) public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options)

View File

@ -19,6 +19,7 @@ class BroodsTable extends AppTable
parent::initialize($config); parent::initialize($config);
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
$this->addBehavior('AuditLog');
$this->BelongsTo( $this->BelongsTo(
'Organisations' 'Organisations'
); );

View File

@ -14,6 +14,7 @@ class EncryptionKeysTable extends AppTable
{ {
parent::initialize($config); parent::initialize($config);
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('AuditLog');
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
$this->belongsTo( $this->belongsTo(
'Individuals', 'Individuals',

View File

@ -19,7 +19,7 @@ class InboxTable extends AppTable
parent::initialize($config); parent::initialize($config);
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
$this->addBehavior('AuditLog');
$this->belongsTo('Users'); $this->belongsTo('Users');
$this->setDisplayField('title'); $this->setDisplayField('title');
} }

View File

@ -16,6 +16,7 @@ class IndividualsTable extends AppTable
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
$this->addBehavior('Tags.Tag'); $this->addBehavior('Tags.Tag');
$this->addBehavior('AuditLog');
$this->hasMany( $this->hasMany(
'Alignments', 'Alignments',
[ [

View File

@ -18,6 +18,8 @@ class InstanceTable extends AppTable
public function initialize(array $config): void public function initialize(array $config): void
{ {
parent::initialize($config); parent::initialize($config);
$this->addBehavior('AuditLog');
$this->setDisplayField('name');
} }
public function validationDefault(Validator $validator): Validator public function validationDefault(Validator $validator): Validator

View File

@ -30,6 +30,7 @@ class LocalToolsTable extends AppTable
public function initialize(array $config): void public function initialize(array $config): void
{ {
parent::initialize($config); parent::initialize($config);
$this->addBehavior('AuditLog');
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
} }

View File

@ -12,6 +12,7 @@ class MetaFieldsTable extends AppTable
{ {
parent::initialize($config); parent::initialize($config);
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('AuditLog');
$this->setDisplayField('field'); $this->setDisplayField('field');
$this->belongsTo('MetaTemplates'); $this->belongsTo('MetaTemplates');
$this->belongsTo('MetaTemplateFields'); $this->belongsTo('MetaTemplateFields');

View File

@ -20,6 +20,7 @@ class OrganisationsTable extends AppTable
parent::initialize($config); parent::initialize($config);
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
$this->addBehavior('Tags.Tag'); $this->addBehavior('Tags.Tag');
$this->addBehavior('AuditLog');
$this->hasMany( $this->hasMany(
'Alignments', 'Alignments',
[ [

View File

@ -28,6 +28,7 @@ class OutboxProcessorsTable extends AppTable
if (empty($this->outboxProcessors)) { if (empty($this->outboxProcessors)) {
$this->loadProcessors(); $this->loadProcessors();
} }
$this->addBehavior('AuditLog');
} }
public function getProcessor($scope, $action=null) public function getProcessor($scope, $action=null)

View File

@ -19,8 +19,8 @@ class OutboxTable extends AppTable
parent::initialize($config); parent::initialize($config);
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
$this->belongsTo('Users'); $this->belongsTo('Users');
$this->addBehavior('AuditLog');
$this->setDisplayField('title'); $this->setDisplayField('title');
} }

View File

@ -18,6 +18,7 @@ class RemoteToolConnectionsTable extends AppTable
'LocalTools' 'LocalTools'
); );
$this->setDisplayField('id'); $this->setDisplayField('id');
$this->addBehavior('AuditLog');
} }
public function validationDefault(Validator $validator): Validator public function validationDefault(Validator $validator): Validator

View File

@ -12,6 +12,7 @@ class RolesTable extends AppTable
{ {
parent::initialize($config); parent::initialize($config);
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('AuditLog');
$this->hasMany( $this->hasMany(
'Users', 'Users',
[ [

View File

@ -26,6 +26,7 @@ class SettingsTable extends AppTable
parent::initialize($config); parent::initialize($config);
$this->setTable(false); $this->setTable(false);
$this->SettingsProvider = new CerebrateSettingsProvider(); $this->SettingsProvider = new CerebrateSettingsProvider();
$this->addBehavior('AuditLog');
} }
public function getSettings($full=false): array public function getSettings($full=false): array

View File

@ -15,6 +15,7 @@ class SharingGroupsTable extends AppTable
parent::initialize($config); parent::initialize($config);
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
$this->addBehavior('AuditLog');
$this->belongsTo( $this->belongsTo(
'Users' 'Users'
); );

View File

@ -20,6 +20,7 @@ class UsersTable extends AppTable
parent::initialize($config); parent::initialize($config);
$this->addBehavior('Timestamp'); $this->addBehavior('Timestamp');
$this->addBehavior('UUID'); $this->addBehavior('UUID');
$this->addBehavior('AuditLog');
$this->initAuthBehaviors(); $this->initAuthBehaviors();
$this->belongsTo( $this->belongsTo(
'Individuals', 'Individuals',