Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
df54547
QA observations solved. New Helper added to change Key Names
CarliPinell Jul 6, 2023
b7758c4
Merge branch 'develop' into feature/FOUR-8121
pmPaulis Jul 7, 2023
36bfd4e
Merge branch 'develop' into feature/FOUR-8121
pmPaulis Jul 8, 2023
2b12f85
Fixing multiple Categories
CarliPinell Jul 10, 2023
44b6b9a
Merge branch 'feature/FOUR-8121' of github.com:ProcessMaker/processma…
CarliPinell Jul 10, 2023
9209065
FOUR-8265
pmPaulis Jun 16, 2023
251801b
FOUR-8901
pmPaulis Jul 11, 2023
e717152
modifying QA observations
CarliPinell Jul 11, 2023
44002ad
QA observations solved. Ready to PR
CarliPinell Jul 11, 2023
23228ad
Merge branch 'feature/FOUR-8121' of github.com:ProcessMaker/processma…
CarliPinell Jul 11, 2023
a7dd21d
Merge remote-tracking branch 'origin/feature/FOUR-8121' into feature/…
pmPaulis Jul 11, 2023
76a99f9
Test error fixed
CarliPinell Jul 12, 2023
37474d8
Change Namespace from ArrayHelperTest
CarliPinell Jul 12, 2023
be04cb5
Merge pull request #4961 from ProcessMaker/feature/FOUR-9014
pmPaulis Jul 13, 2023
e02550f
FOUR-9268
pmPaulis Jul 11, 2023
188c40c
Merge pull request #4984 from ProcessMaker/feature/FOUR-9207
pmPaulis Jul 13, 2023
1435bec
Solving issues
pmPaulis Jul 13, 2023
bcfe4e1
Conflicts
pmPaulis Jul 13, 2023
86f4c0c
Merge pull request #4982 from ProcessMaker/feature/FOUR-9268
pmPaulis Jul 13, 2023
6794f97
Creating BPMN constant
CarliPinell Jul 13, 2023
e448c9c
Merge pull request #4994 from ProcessMaker/feature/FOUR-8942
pmPaulis Jul 13, 2023
e343820
Replacing long S3 Hyperlink to short download
CarliPinell Jul 14, 2023
a90974c
Merge pull request #4998 from ProcessMaker/feature/FOUR-9348
fagubla Jul 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions ProcessMaker/Events/AuthClientCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,46 @@ class AuthClientCreated implements SecurityLogEventInterface

private array $data;

private array $changes;

/**
* Create a new event instance.
*
* @param array $data
*
* @return void
*/
public function __construct(array $created_values)
public function __construct(array $data)
{
$this->data = [
'auth_client_id' => $created_values['id'],
'name' => $created_values['name'],
'user_id' => $created_values['user_id'],
'revoked' => $created_values['revoked'],
'provider' => $created_values['provider'],
'redirect' => $created_values['redirect'],
'password_client' => $created_values['password_client'],
'personal_access_client' => $created_values['personal_access_client'],
];
$this->changes = $created_values;
$this->data = $data;
}

/**
* Return event data
*/
public function getData(): array
{
return $this->data;
return [
'name' => [
'label' => $this->data['name'],
'link' => route('auth-clients.index'),
],
'auth_client_id' => $this->data['id'] ?? '',
'user_id' => $this->data['user_id'] ?? '',
'revoked' => $this->data['revoked'] ?? '',
'provider' => $this->data['provider'] ?? '',
'redirect' => $this->data['redirect'] ?? '',
'personal_access_client' => $this->data['personal_access_client'] ?? '',
'created_at' => $this->data['created_at'] ?? '',
];
}

/**
* Return event changes
*/
public function getChanges(): array
{
return $this->changes;
return [
'id' => $this->data['id']
];
}

/**
Expand Down
17 changes: 8 additions & 9 deletions ProcessMaker/Events/AuthClientUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,44 @@ class AuthClientUpdated implements SecurityLogEventInterface
use FormatSecurityLogChanges;

private array $original;

private array $data;

private array $changes;

private string $clientId;
private string $clientName;

/**
* Create a new event instance.
*
* @return void
*/
public function __construct(string $clientId, array $originalValues, array $changedValues)
public function __construct(string $clientId, array $originalValues, array $changedValues, $name = '')
{
$this->original = $originalValues;
$this->changes = $changedValues;
$this->clientId = $clientId;
$this->clientName = $name;
}

/**
* Return event data
* Return event data
*/
public function getData(): array
{
return array_merge([
'auth_client_id' => $this->clientId,
'name' => [
'label' => $this->changes['name'] ?? $this->clientName,
'link' => route('auth-clients.index'),
],
'last_modified' => $this->changes['updated_at'] ?? Carbon::now(),
], $this->formatChanges($this->changes, $this->original));
}

/**
* Return event changes
* Return event changes
*/
public function getChanges(): array
{
return [
'auth_client_id' => $this->clientId,
'id' => $this->clientId,
];
}

Expand Down
9 changes: 7 additions & 2 deletions ProcessMaker/Events/CustomizeUiUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function __construct(array $original, array $changes)
* Building the data
*/
public function buildData()
public function buildData()
{
if (isset($this->changes['variables'])) {
$varChanges = [];
Expand All @@ -56,7 +55,13 @@ public function buildData()
$this->original['variables'] = $varOriginal;
}
$this->data = array_merge(
['last_modified' => Carbon::now()],
[
'name' => [
'label' => 'Customize Ui',
'link' => route('customize-ui.edit'),
],
'last_modified' => Carbon::now()
],
$this->formatChanges($this->changes, $this->original)
);
}
Expand Down
11 changes: 8 additions & 3 deletions ProcessMaker/Events/PermissionUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

class PermissionUpdated implements SecurityLogEventInterface
{
use Dispatchable, FormatSecurityLogChanges;
use Dispatchable;
use FormatSecurityLogChanges;

private array $changedPermissions;

Expand All @@ -24,8 +25,12 @@ class PermissionUpdated implements SecurityLogEventInterface
*
* @return void
*/
public function __construct(array $changedPermissions, array $originalPermissions, bool $permissionType, string $userId)
{
public function __construct(
array $changedPermissions,
array $originalPermissions,
bool $permissionType,
string $userId
) {
$this->changedPermissions = $changedPermissions;
$this->originalPermissions = $originalPermissions;
$this->permissionType = $permissionType;
Expand Down
2 changes: 2 additions & 0 deletions ProcessMaker/Events/ProcessCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ProcessCreated implements SecurityLogEventInterface

public const TEMPLATE_CREATION = 'TEMPLATE';

public const BPMN_CREATION = 'BPMN';

/**
* Create a new event instance.
*
Expand Down
6 changes: 4 additions & 2 deletions ProcessMaker/Events/ProcessPublished.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ public function __construct(Process $data, array $changes, array $original)
$this->original = array_diff_key($original, array_flip($this::REMOVE_KEYS));

// Get category name
$this->original['process_category'] = isset($original['process_category_id']) ? ProcessCategory::getNamesByIds($this->original['process_category_id']) : '';
$this->original['process_category'] = isset($original['process_category_id'])
? ProcessCategory::getNamesByIds($this->original['process_category_id']) : '';
unset($this->original['process_category_id']);
$this->changes['process_category'] = isset($changes['process_category_id']) ? ProcessCategory::getNamesByIds($this->changes['process_category_id']) : '';
$this->changes['process_category'] = isset($changes['process_category_id'])
? ProcessCategory::getNamesByIds($this->changes['process_category_id']) : '';
unset($this->changes['process_category_id']);
}

Expand Down
54 changes: 54 additions & 0 deletions ProcessMaker/Events/QueueManagementAccessed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace ProcessMaker\Events;

use Carbon\Carbon;
use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;

class QueueManagementAccessed implements SecurityLogEventInterface
{
use Dispatchable;

/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
}

/**
* Get specific data related to the event
*
* @return array
*/
public function getData(): array
{
return [
'name' => 'Laravel Horizon',
'accessed_at' => Carbon::now(),
];
}

/**
* Get specific changes without format related to the event
*
* @return array
*/
public function getChanges(): array
{
return [];
}

/**
* Get the Event name with the syntax ‘[Past-test Action] [Object]’
*
* @return string
*/
public function getEventName(): string
{
return 'QueueManagementAccessed';
}
}
15 changes: 10 additions & 5 deletions ProcessMaker/Events/ScreenCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ProcessMaker\Events;

use Carbon\Carbon;
use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Models\ScreenCategory;
Expand All @@ -21,9 +22,9 @@ public function __construct(array $newScreen)
{
$this->newScreen = $newScreen;

if (isset($newScreen['screen_category_id'])) {
$this->newScreen['screen_category'] = ScreenCategory::getNamesByIds($newScreen['screen_category_id']);
unset($this->newScreen['screen_category_id']);
if (isset($newScreen['tmp_screen_category_id'])) {
$this->newScreen['screen_category'] = ScreenCategory::getNamesByIds($newScreen['tmp_screen_category_id']);
unset($newScreen['tmp_screen_category_id']);
}
}

Expand All @@ -35,10 +36,14 @@ public function __construct(array $newScreen)
public function getData(): array
{
return [
'name' => $this->newScreen['title'] ?? '',
'name' => [
'label' => $this->newScreen['title'],
'link' => route('screen-builder.edit', ['screen' => $this->newScreen['id']]),
],
'description' => $this->newScreen['description'] ?? '',
'type' => $this->newScreen['type'] ?? '',
'screen_category_id' => $this->newScreen['screen_category_id'] ?? '',
'Screen Categories' => $this->newScreen['screen_category'] ?? '',
'created_at' => $this->newScreen['created_at'] ?? Carbon::now(),
];
}

Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Events/ScreenDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function __construct(Screen $screen)
public function getData(): array
{
return [
'title' => $this->screen->getAttributes()['title'],
'description' => $this->screen->getAttributes()['description'],
'name' => $this->screen->getAttribute('title'),
'description' => $this->screen->getAttribute('description'),
'deleted_at' => Carbon::now(),
];
}
Expand Down
27 changes: 20 additions & 7 deletions ProcessMaker/Events/ScreenUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Helpers\ArrayHelper;
use ProcessMaker\Models\Screen;
use ProcessMaker\Models\ScreenCategory;
use ProcessMaker\Traits\FormatSecurityLogChanges;
Expand All @@ -19,6 +20,11 @@ class ScreenUpdated implements SecurityLogEventInterface

private array $original;

public const REMOVE_KEYS = [
'screen_category_id',
'tmp_screen_category_id'
];

/**
* Create a new event instance.
*
Expand All @@ -31,10 +37,12 @@ public function __construct(Screen $screen, array $changes, array $original)
$this->original = $original;

// Get category name
$this->original['screen_category'] = isset($original['screen_category_id']) ? ScreenCategory::getNamesByIds($this->original['screen_category_id']) : '';
$this->original['screen_category'] = isset($original['screen_category_id'])
? ScreenCategory::getNamesByIds($this->original['screen_category_id']) : '';
unset($this->original['screen_category_id']);
$this->changes['screen_category'] = isset($changes['screen_category_id']) ? ScreenCategory::getNamesByIds($this->changes['screen_category_id']) : '';
unset($this->changes['screen_category_id']);
$this->changes['screen_category'] = isset($changes['tmp_screen_category_id'])
? ScreenCategory::getNamesByIds($this->changes['tmp_screen_category_id']) : '';
$this->changes = array_diff_key($this->changes, array_flip($this::REMOVE_KEYS));
}

/**
Expand All @@ -44,14 +52,19 @@ public function __construct(Screen $screen, array $changes, array $original)
*/
public function getData(): array
{
$basic = [
'name' => [
'label' => $this->screen->getAttribute('title'),
'link' => route('screen-builder.edit', ['screen' => $this->screen->getAttribute('id')]),
],
'last_modified' => $this->screen->getAttribute('updated_at'),
];
if (array_key_exists('config', $this->changes)) {
return array_merge([
'last_modified' => $this->screen->getAttribute('updated_at'),
]);
return $basic;
} else {
return array_merge([
'last_modified' => $this->screen->getAttribute('updated_at'),
], $this->formatChanges($this->changes, $this->original));
], ArrayHelper::getArrayDifferencesWithFormat($this->changes, $this->original));
}
}

Expand Down
Loading