Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
26aeff6
feature/FOUR-8705
luNunezProcessmaker May 30, 2023
5bb72a8
feature/FOUR-8704
luNunezProcessmaker May 30, 2023
16002a0
Qa observations fixed in Create and Delete Scripts
CarliPinell Jun 26, 2023
d49bef3
Merge branch 'feature/FOUR-8121' of github.com:ProcessMaker/processma…
CarliPinell Jun 26, 2023
ad02090
Ready to PR
CarliPinell Jun 26, 2023
6454d47
FOUR-8697
pmPaulis Jun 26, 2023
80ae707
Merge pull request #4919 from ProcessMaker/feature/FOUR-8697
pmPaulis Jun 26, 2023
8282051
FOUR-8720: Add S3 Download
pmPaulis Jun 22, 2023
9b6d0f0
Merge branch 'feature/FOUR-8121' of github.com:ProcessMaker/processma…
CarliPinell Jun 27, 2023
85d2616
Observations fixed
CarliPinell Jun 27, 2023
343c66b
Adding changes
pmPaulis Jun 27, 2023
7d19a0c
Adding league/flysystem-aws-s3-v3
pmPaulis Jun 27, 2023
40d3131
test
pmPaulis Jun 27, 2023
fff2297
Ready to PR: FOUR-9161: Create a Helper to get the all the categories
CarliPinell Jun 28, 2023
4b7e7ce
Merge branch 'feature/FOUR-8121' of https://github.com/ProcessMaker/p…
luNunezProcessmaker Jun 28, 2023
b8bb6ae
Fixing assert in Test
CarliPinell Jun 28, 2023
6f6e6c3
Fixing assert in Test
CarliPinell Jun 28, 2023
ce559fc
Merge pull request #4928 from ProcessMaker/feature/FOUR-8720-IT5
pmPaulis Jun 29, 2023
6ea2500
Modified ScreenCategory Model instead of array
CarliPinell Jun 29, 2023
3c07d22
Model modify
CarliPinell Jun 29, 2023
ab84306
Refactoring calls to change Category Id's to names
CarliPinell Jun 29, 2023
737c0a5
Merge branch 'feature/FOUR-8121' of github.com:ProcessMaker/processma…
CarliPinell Jun 29, 2023
44b8a12
Removing unused namespaces
CarliPinell Jun 29, 2023
d5514d1
FOUR-9018
pmPaulis Jun 28, 2023
8dec864
Merge pull request #4937 from ProcessMaker/feature/FOUR-9018
pmPaulis Jun 30, 2023
784ffd0
Merge branch 'develop' into feature/FOUR-8121
pmPaulis Jun 30, 2023
d8a6bb6
Adding fake test data to Model Tests
CarliPinell Jun 29, 2023
48afdd6
Merge branch 'feature/FOUR-8121' into feature/FOUR-9160
pmPaulis Jun 30, 2023
efa8582
Adding changes to Categories events
CarliPinell Jun 30, 2023
abc9b99
Observations solved
CarliPinell Jun 30, 2023
4e71e3e
Last observations about category_id applied
CarliPinell Jul 4, 2023
a042638
Merge branch 'feature/FOUR-8121' of https://github.com/ProcessMaker/p…
luNunezProcessmaker Jul 4, 2023
5d79c66
Merge pull request #4926 from ProcessMaker/feature/FOUR-8793
pmPaulis Jul 4, 2023
2fd1d2d
Merge pull request #4824 from ProcessMaker/feature/FOUR-8704
pmPaulis Jul 4, 2023
3358f5d
Merge pull request #4825 from ProcessMaker/feature/FOUR-8705
pmPaulis Jul 4, 2023
18f1fba
FOUR-9155
pmPaulis Jul 4, 2023
2d0fc6f
FOUR-9174
pmPaulis Jul 4, 2023
5c21e73
Merging solved conflicts with ScriptCreated
CarliPinell Jul 5, 2023
7a8cf23
Merge pull request #4948 from ProcessMaker/feature/FOUR-9084-last2
pmPaulis Jul 5, 2023
524e014
Merge pull request #4953 from ProcessMaker/feature/FOUR-9155
pmPaulis Jul 5, 2023
5b4f32b
Add new Modal Sort Function
CarliPinell Jul 6, 2023
fcff906
Observations solved
CarliPinell Jul 6, 2023
5f6ea02
FOUR-9176
pmPaulis Jul 5, 2023
dd3dfc0
Merge pull request #4958 from ProcessMaker/feature/FOUR-9176
pmPaulis Jul 7, 2023
33bc86a
Merge remote-tracking branch 'origin/feature/FOUR-8121' into feature/…
pmPaulis Jul 7, 2023
e9c19e2
Merge pull request #4960 from ProcessMaker/feature/FOUR-9010
pmPaulis Jul 7, 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
12 changes: 8 additions & 4 deletions ProcessMaker/Events/AuthClientDeleted.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;

Expand All @@ -18,18 +19,21 @@ class AuthClientDeleted implements SecurityLogEventInterface
*
* @return void
*/
public function __construct(array $deleted_values)
public function __construct(array $values)
{
$this->data = ['auth_client_id' => $deleted_values['id']];
$this->changes = $deleted_values;
$this->changes = $values;
}

/**
* Return event data
*/
public function getData(): array
{
return $this->data;
return [
'auth_client_id' => $this->changes['id'] ?? 0,
'name' => $this->changes['name'] ?? 0,
'deleted_at' => Carbon::now()
];
}

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

namespace ProcessMaker\Events;

use Carbon\Carbon;
use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Traits\FormatSecurityLogChanges;

class FilesAccessed implements SecurityLogEventInterface
{
use Dispatchable;
use FormatSecurityLogChanges;

private array $linkFile = [];
private string $processName = '';

/**
* Create a new event instance.
*
* @return void
*/
public function __construct(string $name, ProcessRequest $data = null)
{
// Check if the file is related to the request
if (!is_null($data)) {
$this->processName = $data->getAttribute('name');
// Link to the request
$this->linkFile = [
'label' => $data->getAttribute('id'),
'link' => route('requests.show', $data)
];
} else {
// Link to file in the package
$this->linkFile = [
'label' => $name,
'link' => route('file-manager.index', ['public/' . $name]),
];
}
}

/**
* Get specific data related to the event
*
* @return array
*/
public function getData(): array
{
return [
'name' => $this->linkFile,
'process' => $this->processName,
'accessed_at' => Carbon::now()
];
}

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

/**
* Get the Event name
*
* @return string
*/
public function getEventName(): string
{
return 'FilesAccessed';
}
}
30 changes: 25 additions & 5 deletions ProcessMaker/Events/FilesCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,46 @@
use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Models\Media;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Traits\FormatSecurityLogChanges;

class FilesCreated implements SecurityLogEventInterface
{
use Dispatchable;
use FormatSecurityLogChanges;

public const NAME_PUBLIC_FILES = 'Public Files';

private array $media;
private array $name = [];
private string $processName = '';

/**
* Create a new event instance.
*
* @return void
*/
public function __construct(int $fileId)
public function __construct(int $fileId, ProcessRequest $data)
{
$this->media = Media::find(['id' => $fileId])->toArray();
$this->media = head($this->media);

// Check if the request is related to the package files
if (static::NAME_PUBLIC_FILES === $data->getAttribute('name')) {
$this->processName = '';
// Link to file in the package
$this->name = [
'label' => $this->media['name'],
'link' => route('file-manager.index', ['public/' . $this->media['name']]),
];
} else {
$this->processName = $data->getAttribute('name');
// Link to the request
$this->name = [
'label' => $data->getAttribute('id'),
'link' => route('requests.show', $data)
];
}
}

/**
Expand All @@ -33,10 +55,8 @@ public function __construct(int $fileId)
public function getData(): array
{
return [
'file_name' => [
'label' => $this->media['name'],
'link' => route('file-manager.index', ['public/' . $this->media['file_name']]),
],
'name' => $this->name,
'process' => $this->processName,
'created_at' => $this->media['created_at'],
];
}
Expand Down
76 changes: 76 additions & 0 deletions ProcessMaker/Events/FilesDownloaded.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

namespace ProcessMaker\Events;

use Carbon\Carbon;
use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Traits\FormatSecurityLogChanges;

class FilesDownloaded implements SecurityLogEventInterface
{
use Dispatchable;
use FormatSecurityLogChanges;

private array $name = [];
private string $processName = '';

/**
* Create a new event instance.
*
* @return void
*/
public function __construct(string $file, ProcessRequest $data = null)
{
// Check if the file is related to the request
if (!is_null($data)) {
$this->processName = $data->getAttribute('name');
// Link to the request
$this->name = [
'label' => $data->getAttribute('id'),
'link' => route('requests.show', $data)
];
} else {
// Link to file in the package
$this->name = [
'label' => $file,
'link' => route('file-manager.index', ['public/' . $file]),
];
}
}

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

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

/**
* Get the Event name
*
* @return string
*/
public function getEventName(): string
{
return 'FilesDownloaded';
}
}
7 changes: 7 additions & 0 deletions ProcessMaker/Events/ProcessPublished.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Models\Process;
use ProcessMaker\Models\ProcessCategory;
use ProcessMaker\Traits\FormatSecurityLogChanges;

class ProcessPublished implements SecurityLogEventInterface
Expand Down Expand Up @@ -39,6 +40,12 @@ public function __construct(Process $data, array $changes, array $original)
$this->process = $data;
$this->changes = array_diff_key($changes, array_flip($this::REMOVE_KEYS));
$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']) : '';
unset($this->original['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
6 changes: 6 additions & 0 deletions ProcessMaker/Events/ScreenCreated.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\Models\ScreenCategory;

class ScreenCreated implements SecurityLogEventInterface
{
Expand All @@ -19,6 +20,11 @@ class ScreenCreated implements SecurityLogEventInterface
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']);
}
}

/**
Expand Down
7 changes: 7 additions & 0 deletions ProcessMaker/Events/ScreenUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Models\Screen;
use ProcessMaker\Models\ScreenCategory;
use ProcessMaker\Traits\FormatSecurityLogChanges;

class ScreenUpdated implements SecurityLogEventInterface
Expand All @@ -28,6 +29,12 @@ public function __construct(Screen $screen, array $changes, array $original)
$this->screen = $screen;
$this->changes = $changes;
$this->original = $original;

// Get category name
$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']);
}

/**
Expand Down
12 changes: 10 additions & 2 deletions ProcessMaker/Events/ScriptCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Models\Script;
use ProcessMaker\Models\ScriptCategory;
use ProcessMaker\Traits\FormatSecurityLogChanges;

class ScriptCreated implements SecurityLogEventInterface
Expand All @@ -13,9 +14,8 @@ class ScriptCreated implements SecurityLogEventInterface
use FormatSecurityLogChanges;

private array $changes;

private array $original;

public string $categoryName = '';
private Script $script;

/**
Expand Down Expand Up @@ -49,11 +49,19 @@ public function getChanges(): array
*/
public function getData(): array
{
$categoryId = $this->script['script_category_id'] ?? '';
if (!empty($categoryId)) {
$categoryName = ScriptCategory::where('id', $categoryId)->value('name');
}

$basic = isset($this->changes['code']) ? [
'name' => $this->script->getAttribute('title'),
'created_at' => $this->script->getAttribute('created_at'),
] : [
'name' => $this->script->getAttribute('title'),
'description' => $this->script->getAttribute('description'),
'category' => $categoryName,
'language' => $this->script->getAttribute('language')
];
unset($this->changes['code']);
unset($this->original['code']);
Expand Down
2 changes: 2 additions & 0 deletions ProcessMaker/Events/ScriptDeleted.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\Script;
Expand Down Expand Up @@ -45,6 +46,7 @@ public function getData(): array
{
return [
'name' => $this->script->getAttribute('title'),
'deleted_at' => Carbon::now()
];
}

Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Events/ScriptExecutorCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(array $created_values)
$this->data = [
'script_executor_id' => $created_values['id'],
'title' => $created_values['title'],
'description' => $created_values['description'],
'description' => isset($created_values['description']) ? $created_values['description'] : "",
'language' => $created_values['language'],
'config' => $created_values['config'],
];
Expand Down
7 changes: 7 additions & 0 deletions ProcessMaker/Events/ScriptUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Models\Script;
use ProcessMaker\Models\ScriptCategory;
use ProcessMaker\Traits\FormatSecurityLogChanges;

class ScriptUpdated implements SecurityLogEventInterface
Expand All @@ -30,6 +31,12 @@ public function __construct(Script $script, array $changes, array $original)
$this->script = $script;
$this->changes = $changes;
$this->original = $original;

// Get category name
$this->original['script_category'] = isset($original['script_category_id']) ? ScriptCategory::getNamesByIds($this->original['script_category_id']) : '';
unset($this->original['script_category_id']);
$this->changes['script_category'] = isset($changes['script_category_id']) ? ScriptCategory::getNamesByIds($this->changes['script_category_id']) : '';
unset($this->changes['script_category_id']);
}

/**
Expand Down
Loading