diff --git a/ProcessMaker/Contracts/SecurityLogEventInterface.php b/ProcessMaker/Contracts/SecurityLogEventInterface.php
index 1cc65f03ab..b3b625851e 100644
--- a/ProcessMaker/Contracts/SecurityLogEventInterface.php
+++ b/ProcessMaker/Contracts/SecurityLogEventInterface.php
@@ -9,4 +9,4 @@ public function getData(): array;
public function getChanges(): array;
public function getEventName(): string;
-}
\ No newline at end of file
+}
diff --git a/ProcessMaker/Events/AuthClientCreated.php b/ProcessMaker/Events/AuthClientCreated.php
index c4760da33e..aeef616299 100644
--- a/ProcessMaker/Events/AuthClientCreated.php
+++ b/ProcessMaker/Events/AuthClientCreated.php
@@ -10,6 +10,7 @@ class AuthClientCreated implements SecurityLogEventInterface
use Dispatchable;
private array $data;
+
private array $changes;
/**
@@ -27,21 +28,21 @@ public function __construct(array $created_values)
'provider' => $created_values['provider'],
'redirect' => $created_values['redirect'],
'password_client' => $created_values['password_client'],
- 'personal_access_client' => $created_values['personal_access_client']
+ 'personal_access_client' => $created_values['personal_access_client'],
];
$this->changes = $created_values;
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/AuthClientDeleted.php b/ProcessMaker/Events/AuthClientDeleted.php
index c8c2214056..1eb9e92dfa 100644
--- a/ProcessMaker/Events/AuthClientDeleted.php
+++ b/ProcessMaker/Events/AuthClientDeleted.php
@@ -10,6 +10,7 @@ class AuthClientDeleted implements SecurityLogEventInterface
use Dispatchable;
private array $data;
+
private array $changes;
/**
@@ -22,17 +23,17 @@ public function __construct(array $deleted_values)
$this->data = ['auth_client_id' => $deleted_values['id']];
$this->changes = $deleted_values;
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/AuthClientUpdated.php b/ProcessMaker/Events/AuthClientUpdated.php
index 006be78ac6..45e86fcc4b 100644
--- a/ProcessMaker/Events/AuthClientUpdated.php
+++ b/ProcessMaker/Events/AuthClientUpdated.php
@@ -11,8 +11,11 @@ class AuthClientUpdated implements SecurityLogEventInterface
use Dispatchable, FormatSecurityLogChanges;
private array $original;
+
private array $data;
+
private array $changes;
+
private string $clientId;
/**
@@ -31,22 +34,23 @@ public function __construct(string $clientId, array $original_values, array $cha
/**
* Building the data
*/
- public function buildData() {
+ public function buildData()
+ {
$this->data = array_merge([
- 'auth_client_id' => $this->clientId
+ 'auth_client_id' => $this->clientId,
], $this->formatChanges($this->changes, $this->original));
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/CategoryCreated.php b/ProcessMaker/Events/CategoryCreated.php
index ae687c0f97..1d8615e358 100644
--- a/ProcessMaker/Events/CategoryCreated.php
+++ b/ProcessMaker/Events/CategoryCreated.php
@@ -13,6 +13,7 @@ class CategoryCreated implements SecurityLogEventInterface
use FormatSecurityLogChanges;
private ProcessCategory $category;
+
private array $variable = [];
/**
@@ -51,7 +52,7 @@ public function getData(): array
public function getChanges(): array
{
return [
- $this->category
+ $this->category,
];
}
diff --git a/ProcessMaker/Events/CategoryDeleted.php b/ProcessMaker/Events/CategoryDeleted.php
index 5488759bdc..4153a29dcc 100644
--- a/ProcessMaker/Events/CategoryDeleted.php
+++ b/ProcessMaker/Events/CategoryDeleted.php
@@ -20,7 +20,7 @@ class CategoryDeleted implements SecurityLogEventInterface
*/
public function __construct(ProcessCategory $data)
{
- $this->processCategory = $data;
+ $this->processCategory = $data;
}
/**
@@ -32,7 +32,7 @@ public function getData(): array
{
return [
'category_name' => $this->processCategory->getAttribute('name'),
- 'deleted_at' => Carbon::now()
+ 'deleted_at' => Carbon::now(),
];
}
@@ -41,13 +41,12 @@ public function getData(): array
*
* @return array
*/
-
public function getChanges(): array
{
return [
'id' => $this->processCategory->getAttribute('id'),
'name' => $this->processCategory->getAttribute('name'),
- 'status' => $this->processCategory->getAttribute('status')
+ 'status' => $this->processCategory->getAttribute('status'),
];
}
diff --git a/ProcessMaker/Events/CategoryUpdated.php b/ProcessMaker/Events/CategoryUpdated.php
index 05594914dc..73a4baa048 100644
--- a/ProcessMaker/Events/CategoryUpdated.php
+++ b/ProcessMaker/Events/CategoryUpdated.php
@@ -15,6 +15,7 @@ class CategoryUpdated implements SecurityLogEventInterface
private ProcessCategory $category;
private array $changes;
+
private array $original;
/**
diff --git a/ProcessMaker/Events/CustomizeUiUpdated.php b/ProcessMaker/Events/CustomizeUiUpdated.php
index 151a9e512b..a961fe6fb9 100755
--- a/ProcessMaker/Events/CustomizeUiUpdated.php
+++ b/ProcessMaker/Events/CustomizeUiUpdated.php
@@ -11,7 +11,9 @@ class CustomizeUiUpdated implements SecurityLogEventInterface
use Dispatchable, FormatSecurityLogChanges;
private array $data;
+
private array $changes;
+
private array $original;
/**
@@ -35,36 +37,36 @@ public function __construct(array $original, array $changes, string $updatedAt)
/**
* Building the data
*/
- public function buildData()
+ public function buildData()
{
if (isset($this->changes['variables'])) {
$variables_changes = [];
$variables_original = [];
- foreach ((array)json_decode($this->changes['variables'], true) as $variable) {
+ foreach ((array) json_decode($this->changes['variables'], true) as $variable) {
$variables_changes[$variable['title']] = $variable['value'];
}
- foreach ((array)json_decode($this->original['variables'], true) as $variable) {
+ foreach ((array) json_decode($this->original['variables'], true) as $variable) {
$variables_original[$variable['title']] = $variable['value'];
}
$variables_changes = array_diff($variables_changes, $variables_original);
$variables_original = array_intersect_key($variables_original, $variables_changes);
-
+
$this->changes['variables'] = $variables_changes;
$this->original['variables'] = $variables_original;
}
$this->data = $this->formatChanges($this->changes, $this->original);
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/EnvironmentVariablesCreated.php b/ProcessMaker/Events/EnvironmentVariablesCreated.php
index e4e32a4afc..49c42abccf 100644
--- a/ProcessMaker/Events/EnvironmentVariablesCreated.php
+++ b/ProcessMaker/Events/EnvironmentVariablesCreated.php
@@ -13,6 +13,7 @@ class EnvironmentVariablesCreated implements SecurityLogEventInterface
use FormatSecurityLogChanges;
private EnvironmentVariable $enVariable;
+
private $variable = [];
/**
diff --git a/ProcessMaker/Events/EnvironmentVariablesDeleted.php b/ProcessMaker/Events/EnvironmentVariablesDeleted.php
index fc0fb8b05a..82acdaa14e 100644
--- a/ProcessMaker/Events/EnvironmentVariablesDeleted.php
+++ b/ProcessMaker/Events/EnvironmentVariablesDeleted.php
@@ -35,7 +35,7 @@ public function getData(): array
return [
'name' => $this->enVariable->getAttribute('name'),
'description' => $this->enVariable->getAttribute('description'),
- 'deleted_at' => Carbon::now()
+ 'deleted_at' => Carbon::now(),
];
}
diff --git a/ProcessMaker/Events/EnvironmentVariablesUpdated.php b/ProcessMaker/Events/EnvironmentVariablesUpdated.php
index e0e294ecab..0756acefa0 100644
--- a/ProcessMaker/Events/EnvironmentVariablesUpdated.php
+++ b/ProcessMaker/Events/EnvironmentVariablesUpdated.php
@@ -15,6 +15,7 @@ class EnvironmentVariablesUpdated implements SecurityLogEventInterface
private EnvironmentVariable $enVariable;
private array $changes;
+
private array $original;
/**
diff --git a/ProcessMaker/Events/GroupCreated.php b/ProcessMaker/Events/GroupCreated.php
index 93d346c23d..f263bc0ba3 100644
--- a/ProcessMaker/Events/GroupCreated.php
+++ b/ProcessMaker/Events/GroupCreated.php
@@ -13,6 +13,7 @@ class GroupCreated implements SecurityLogEventInterface
use FormatSecurityLogChanges;
private Group $group;
+
/**
* Create a new event instance.
*
diff --git a/ProcessMaker/Events/GroupDeleted.php b/ProcessMaker/Events/GroupDeleted.php
index 9f91f71f47..b71a259608 100644
--- a/ProcessMaker/Events/GroupDeleted.php
+++ b/ProcessMaker/Events/GroupDeleted.php
@@ -15,9 +15,13 @@ class GroupDeleted implements SecurityLogEventInterface
use FormatSecurityLogChanges;
private Group $group;
+
private array $userIds;
+
private array $userMembers;
+
private array $groupIds;
+
private array $groupMembers;
/**
@@ -61,7 +65,7 @@ public function getData(): array
'name' => $this->group->getAttribute('name'),
'user_members' => $this->userMembers,
'group_members' => $this->groupMembers,
- 'deleted_at' => Carbon::now()
+ 'deleted_at' => Carbon::now(),
];
}
@@ -74,10 +78,10 @@ public function getChanges(): array
{
return [
'group_name' => [
- $this->group
+ $this->group,
],
'user_members' => $this->userMembers,
- 'group_members' => $this->groupMembers
+ 'group_members' => $this->groupMembers,
];
}
diff --git a/ProcessMaker/Events/GroupUsersUpdated.php b/ProcessMaker/Events/GroupUsersUpdated.php
index 9b8a418509..c8982f1ec5 100644
--- a/ProcessMaker/Events/GroupUsersUpdated.php
+++ b/ProcessMaker/Events/GroupUsersUpdated.php
@@ -12,13 +12,19 @@ class GroupUsersUpdated implements SecurityLogEventInterface
use Dispatchable;
const ADDED = 'added';
+
const DELETED = 'deleted';
private array $data;
+
private int $groupUpdated;
+
private User|Group $member;
+
private string $action;
+
private array $changes;
+
private string $memberType;
/**
@@ -37,16 +43,17 @@ public function __construct(int $groupUpdated, int $memberId, string $action, st
'memberType' => $memberType,
'memberId' => $memberId,
'group' => $groupUpdated,
- 'action' => $action
+ 'action' => $action,
];
}
/**
* Building the data
*/
- public function buildData() {
+ public function buildData()
+ {
$group = Group::findOrFail($this->groupUpdated);
-
+
if ($this->memberType === User::class) {
$type = 'user';
$link = 'users.edit';
@@ -55,46 +62,46 @@ public function buildData() {
$type = 'group';
$link = 'groups.edit';
$label = $this->member->name;
- }
+ }
switch ($this->action) {
- case GroupUsersUpdated::ADDED:
+ case self::ADDED:
$this->data = [
'group' => [
'link' => route('groups.edit', $group),
- 'label' => $group->name
+ 'label' => $group->name,
],
'+ ' . $type => [
'link' => route($link, $this->member),
- 'label' => $label
- ]
+ 'label' => $label,
+ ],
];
break;
- case GroupUsersUpdated::DELETED:
+ case self::DELETED:
$this->data = [
'group' => [
'link' => route('groups.edit', $group),
- 'label' => $group->name
+ 'label' => $group->name,
],
'- ' . $type => [
- 'link' => route( $link, $this->member),
- 'label' => $label
- ]
+ 'link' => route($link, $this->member),
+ 'label' => $label,
+ ],
];
break;
}
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/PermissionUpdated.php b/ProcessMaker/Events/PermissionUpdated.php
index 10d4c0d184..3239b86a69 100644
--- a/ProcessMaker/Events/PermissionUpdated.php
+++ b/ProcessMaker/Events/PermissionUpdated.php
@@ -12,10 +12,13 @@ class PermissionUpdated implements SecurityLogEventInterface
use Dispatchable, FormatSecurityLogChanges;
private array $changedPermissions;
+
private array $originalPermissions;
+
private bool $permissionType;
+
private string $userId;
-
+
/**
* Create a new event instance.
*
@@ -44,7 +47,7 @@ public function getData(): array
'label' => $userData->getAttribute('username'),
'link' => route('users.edit', $this->userId) . '#nav-profile',
],
- '+ permission_names' => 'Super Admin - All Permissions'
+ '+ permission_names' => 'Super Admin - All Permissions',
];
} else {
return array_merge([
diff --git a/ProcessMaker/Events/ProcessCreated.php b/ProcessMaker/Events/ProcessCreated.php
index e1b492cea2..65ad8c5d48 100644
--- a/ProcessMaker/Events/ProcessCreated.php
+++ b/ProcessMaker/Events/ProcessCreated.php
@@ -2,9 +2,9 @@
namespace ProcessMaker\Events;
+use Illuminate\Foundation\Events\Dispatchable;
use ProcessMaker\Contracts\SecurityLogEventInterface;
use ProcessMaker\Models\Process;
-use Illuminate\Foundation\Events\Dispatchable;
class ProcessCreated implements SecurityLogEventInterface
{
@@ -15,6 +15,7 @@ class ProcessCreated implements SecurityLogEventInterface
private string $typeCreation;
public const BLANK_CREATION = 'BLANK';
+
public const TEMPLATE_CREATION = 'TEMPLATE';
/**
diff --git a/ProcessMaker/Events/ProcessPublished.php b/ProcessMaker/Events/ProcessPublished.php
index 936a34988c..05290528ff 100644
--- a/ProcessMaker/Events/ProcessPublished.php
+++ b/ProcessMaker/Events/ProcessPublished.php
@@ -11,6 +11,7 @@ class ProcessPublished implements SecurityLogEventInterface
{
use Dispatchable;
use FormatSecurityLogChanges;
+
// Currently is not required to register the following columns (related to the diagram)
public const REMOVE_KEYS = [
'bpmn',
@@ -19,12 +20,13 @@ class ProcessPublished implements SecurityLogEventInterface
'self_service_tasks',
'signal_events',
'conditional_events',
- 'properties'
+ 'properties',
];
private Process $process;
private array $changes;
+
private array $original;
/**
diff --git a/ProcessMaker/Events/ScreenCreated.php b/ProcessMaker/Events/ScreenCreated.php
index 318bc7a224..16efa5760b 100644
--- a/ProcessMaker/Events/ScreenCreated.php
+++ b/ProcessMaker/Events/ScreenCreated.php
@@ -8,6 +8,7 @@
class ScreenCreated implements SecurityLogEventInterface
{
use Dispatchable;
+
private array $newScreen;
/**
@@ -17,7 +18,7 @@ class ScreenCreated implements SecurityLogEventInterface
*/
public function __construct(array $newScreen)
{
- $this->newScreen = $newScreen;
+ $this->newScreen = $newScreen;
}
/**
@@ -31,7 +32,7 @@ public function getData(): array
'name' => $this->newScreen['title'],
'description' => $this->newScreen['description'],
'type' => $this->newScreen['type'],
- 'screen_category_id' => $this->newScreen['screen_category_id']
+ 'screen_category_id' => $this->newScreen['screen_category_id'],
];
}
diff --git a/ProcessMaker/Events/ScreenDeleted.php b/ProcessMaker/Events/ScreenDeleted.php
index 9468fa1039..a423b6969a 100644
--- a/ProcessMaker/Events/ScreenDeleted.php
+++ b/ProcessMaker/Events/ScreenDeleted.php
@@ -10,6 +10,7 @@
class ScreenDeleted implements SecurityLogEventInterface
{
use Dispatchable;
+
private Screen $screen;
/**
@@ -19,7 +20,7 @@ class ScreenDeleted implements SecurityLogEventInterface
*/
public function __construct(Screen $screen)
{
- $this->screen = $screen;
+ $this->screen = $screen;
}
/**
@@ -32,7 +33,7 @@ public function getData(): array
return [
'title' => $this->screen->getAttributes()['title'],
'description' => $this->screen->getAttributes()['description'],
- 'deleted_at' => Carbon::now()
+ 'deleted_at' => Carbon::now(),
];
}
diff --git a/ProcessMaker/Events/ScreenUpdated.php b/ProcessMaker/Events/ScreenUpdated.php
index 0f209e5101..a7dfe5e054 100644
--- a/ProcessMaker/Events/ScreenUpdated.php
+++ b/ProcessMaker/Events/ScreenUpdated.php
@@ -13,7 +13,9 @@ class ScreenUpdated implements SecurityLogEventInterface
use FormatSecurityLogChanges;
private Screen $screen;
+
private array $changes;
+
private array $original;
/**
@@ -35,7 +37,7 @@ public function __construct(Screen $screen, array $changes, array $original)
*/
public function getData(): array
{
- if (array_key_exists("config", $this->changes)) {
+ if (array_key_exists('config', $this->changes)) {
return array_merge([
'last_modified' => $this->screen->getAttribute('updated_at'),
]);
diff --git a/ProcessMaker/Events/ScriptCreated.php b/ProcessMaker/Events/ScriptCreated.php
index 67bf5d21d0..929c16142e 100644
--- a/ProcessMaker/Events/ScriptCreated.php
+++ b/ProcessMaker/Events/ScriptCreated.php
@@ -13,7 +13,9 @@ class ScriptCreated implements SecurityLogEventInterface
use FormatSecurityLogChanges;
private array $changes;
+
private array $original;
+
private Script $script;
/**
@@ -36,7 +38,7 @@ public function __construct(Script $script, array $changes)
public function getChanges(): array
{
return array_merge([
- 'script_id' => $this->script->id
+ 'script_id' => $this->script->id,
], $this->changes);
}
@@ -55,6 +57,7 @@ public function getData(): array
];
unset($this->changes['code']);
unset($this->original['code']);
+
return array_merge($basic, $this->formatChanges($this->changes, []));
}
diff --git a/ProcessMaker/Events/ScriptDeleted.php b/ProcessMaker/Events/ScriptDeleted.php
index be2d081cfd..cdd422c549 100644
--- a/ProcessMaker/Events/ScriptDeleted.php
+++ b/ProcessMaker/Events/ScriptDeleted.php
@@ -32,7 +32,7 @@ public function __construct(Script $script)
public function getChanges(): array
{
return [
- 'script_id' => $this->script->id
+ 'script_id' => $this->script->id,
];
}
diff --git a/ProcessMaker/Events/ScriptExecutorCreated.php b/ProcessMaker/Events/ScriptExecutorCreated.php
index 31fa4a10e4..f492c80933 100644
--- a/ProcessMaker/Events/ScriptExecutorCreated.php
+++ b/ProcessMaker/Events/ScriptExecutorCreated.php
@@ -10,6 +10,7 @@ class ScriptExecutorCreated implements SecurityLogEventInterface
use Dispatchable;
private array $data;
+
private array $changes;
/**
@@ -25,20 +26,20 @@ public function __construct(array $created_values)
'title' => $created_values['title'],
'description' => $created_values['description'],
'language' => $created_values['language'],
- 'config' => $created_values['config']
+ 'config' => $created_values['config'],
];
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/ScriptExecutorDeleted.php b/ProcessMaker/Events/ScriptExecutorDeleted.php
index bce383c557..65af360ce0 100644
--- a/ProcessMaker/Events/ScriptExecutorDeleted.php
+++ b/ProcessMaker/Events/ScriptExecutorDeleted.php
@@ -10,6 +10,7 @@ class ScriptExecutorDeleted implements SecurityLogEventInterface
use Dispatchable;
private array $data;
+
private array $changes;
/**
@@ -23,20 +24,20 @@ public function __construct(array $deleted_values)
$this->data = [
'script_executor_id' => $deleted_values['id'],
'title' => $deleted_values['title'],
- 'description' => $deleted_values['description']
+ 'description' => $deleted_values['description'],
];
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/ScriptExecutorUpdated.php b/ProcessMaker/Events/ScriptExecutorUpdated.php
index 1617eeca80..274fb1b03e 100644
--- a/ProcessMaker/Events/ScriptExecutorUpdated.php
+++ b/ProcessMaker/Events/ScriptExecutorUpdated.php
@@ -11,8 +11,11 @@ class ScriptExecutorUpdated implements SecurityLogEventInterface
use Dispatchable, FormatSecurityLogChanges;
private array $data;
+
private array $changes;
+
private array $original;
+
private int $scriptId;
/**
@@ -31,22 +34,23 @@ public function __construct(int $scriptId, array $original_values, array $change
/**
* Building the data
*/
- public function buildData() {
+ public function buildData()
+ {
$this->data = array_merge([
- 'script_executor_id' => $this->scriptId
+ 'script_executor_id' => $this->scriptId,
], $this->formatChanges($this->changes, $this->original));
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/ScriptUpdated.php b/ProcessMaker/Events/ScriptUpdated.php
index 2ee9c6710d..09dc1d833d 100644
--- a/ProcessMaker/Events/ScriptUpdated.php
+++ b/ProcessMaker/Events/ScriptUpdated.php
@@ -13,7 +13,9 @@ class ScriptUpdated implements SecurityLogEventInterface
use FormatSecurityLogChanges;
private array $changes;
+
private array $original;
+
private Script $script;
/**
@@ -38,7 +40,7 @@ public function __construct(Script $script, array $changes, array $original)
public function getChanges(): array
{
return array_merge([
- 'script_id' => $this->script->id
+ 'script_id' => $this->script->id,
], $this->changes);
}
@@ -59,6 +61,7 @@ public function getData(): array
];
unset($changes['code']);
unset($original['code']);
+
return array_merge($basic, $this->formatChanges($changes, $original));
}
diff --git a/ProcessMaker/Events/SecurityLogDownloadJobCompleted.php b/ProcessMaker/Events/SecurityLogDownloadJobCompleted.php
index c0f86e6857..e8c3a2801b 100644
--- a/ProcessMaker/Events/SecurityLogDownloadJobCompleted.php
+++ b/ProcessMaker/Events/SecurityLogDownloadJobCompleted.php
@@ -14,8 +14,11 @@ class SecurityLogDownloadJobCompleted implements ShouldBroadcastNow
use Dispatchable, InteractsWithSockets, SerializesModels;
public $user;
+
private bool $success;
+
private ?string $link;
+
private ?string $message;
/**
@@ -64,7 +67,7 @@ public function broadcastWith()
return [
'success' => $this->success,
'message' => $this->message,
- 'link' => $this->link
+ 'link' => $this->link,
];
}
}
diff --git a/ProcessMaker/Events/SettingsUpdated.php b/ProcessMaker/Events/SettingsUpdated.php
index 206d772172..6d93ac764e 100644
--- a/ProcessMaker/Events/SettingsUpdated.php
+++ b/ProcessMaker/Events/SettingsUpdated.php
@@ -12,6 +12,7 @@ class SettingsUpdated implements SecurityLogEventInterface
{
use Dispatchable;
use FormatSecurityLogChanges;
+
public const SENSITIVE_KEYS = [
'password',
];
@@ -19,6 +20,7 @@ class SettingsUpdated implements SecurityLogEventInterface
private Setting $setting;
private array $changes;
+
private array $original;
/**
@@ -56,7 +58,7 @@ public function __construct(Setting $setting, array $changes, array $original)
public function getChanges(): array
{
return array_merge([
- 'setting_id' => $this->setting->id
+ 'setting_id' => $this->setting->id,
], $this->changes);
}
@@ -73,7 +75,7 @@ public function getData(): array
], $this->formatChanges($this->changes, $this->original));
}
- /**
+ /**
* Get specific changes without format related to the event
*
* @return array
diff --git a/ProcessMaker/Events/TemplateCreated.php b/ProcessMaker/Events/TemplateCreated.php
index 1aa9d11621..285d0795b4 100644
--- a/ProcessMaker/Events/TemplateCreated.php
+++ b/ProcessMaker/Events/TemplateCreated.php
@@ -31,7 +31,7 @@ public function getData(): array
return [
'type' => $this->payload['type'],
'version' => $this->payload['version'],
- 'name' => $this->payload['name']
+ 'name' => $this->payload['name'],
];
}
diff --git a/ProcessMaker/Events/TemplateDeleted.php b/ProcessMaker/Events/TemplateDeleted.php
index bff0293ef7..473ddc2520 100644
--- a/ProcessMaker/Events/TemplateDeleted.php
+++ b/ProcessMaker/Events/TemplateDeleted.php
@@ -32,7 +32,7 @@ public function getData(): array
{
return [
'template_name' => $this->template->name,
- 'deleted_at' => Carbon::now()
+ 'deleted_at' => Carbon::now(),
];
}
@@ -45,7 +45,7 @@ public function getChanges(): array
{
return [
'id' => $this->template->id,
- 'template_name' => $this->template->name
+ 'template_name' => $this->template->name,
];
}
diff --git a/ProcessMaker/Events/TemplateUpdated.php b/ProcessMaker/Events/TemplateUpdated.php
index ecbb458b5d..6c74d073da 100644
--- a/ProcessMaker/Events/TemplateUpdated.php
+++ b/ProcessMaker/Events/TemplateUpdated.php
@@ -13,7 +13,9 @@ class TemplateUpdated implements SecurityLogEventInterface
use FormatSecurityLogChanges;
private array $changes;
+
private array $original;
+
private bool $processType;
/**
@@ -38,9 +40,9 @@ public function getData(): array
if ($this->processType) {
return [
'name' => [
- 'label' => $this->processType
+ 'label' => $this->processType,
],
- 'updated_at' => Carbon::now()
+ 'updated_at' => Carbon::now(),
];
} else {
$oldData = array_diff_assoc($this->original, $this->changes);
@@ -48,7 +50,7 @@ public function getData(): array
return array_merge([
'name' => [
- 'label' => $this->processType
+ 'label' => $this->processType,
],
], $this->formatChanges($newData, $oldData));
}
diff --git a/ProcessMaker/Events/TokenCreated.php b/ProcessMaker/Events/TokenCreated.php
index 862d1fe9de..fb34a40723 100644
--- a/ProcessMaker/Events/TokenCreated.php
+++ b/ProcessMaker/Events/TokenCreated.php
@@ -11,6 +11,7 @@ class TokenCreated implements SecurityLogEventInterface
use Dispatchable;
private array $data;
+
private array $changes;
/**
@@ -21,21 +22,21 @@ class TokenCreated implements SecurityLogEventInterface
public function __construct(Token $token)
{
$this->data = [
- "token_id" => $token->getKey()
+ 'token_id' => $token->getKey(),
];
$this->changes = $token->toArray();
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/TokenDeleted.php b/ProcessMaker/Events/TokenDeleted.php
index 5a54999a19..8c1819dc4a 100644
--- a/ProcessMaker/Events/TokenDeleted.php
+++ b/ProcessMaker/Events/TokenDeleted.php
@@ -11,6 +11,7 @@ class TokenDeleted implements SecurityLogEventInterface
use Dispatchable;
private array $data;
+
private array $changes;
/**
@@ -21,22 +22,21 @@ class TokenDeleted implements SecurityLogEventInterface
public function __construct(Token $token)
{
$this->data = [
- "token_id" => $token->getKey()
- ];
+ 'token_id' => $token->getKey(),
+ ];
$this->changes = $token->toArray();
-
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Events/UnauthorizedAccessAttempt.php b/ProcessMaker/Events/UnauthorizedAccessAttempt.php
index 3ed7740fb7..c32f155b39 100644
--- a/ProcessMaker/Events/UnauthorizedAccessAttempt.php
+++ b/ProcessMaker/Events/UnauthorizedAccessAttempt.php
@@ -13,15 +13,14 @@ class UnauthorizedAccessAttempt implements SecurityLogEventInterface
/**
* Create a new event instance.
- *
*/
public function __construct()
{
$this->data = [
'url' => [
'link' => url()->current(),
- 'label' => url()->current()
- ]
+ 'label' => url()->current(),
+ ],
];
}
diff --git a/ProcessMaker/Events/UserDeleted.php b/ProcessMaker/Events/UserDeleted.php
index bfad6fde76..e56a80f9cb 100644
--- a/ProcessMaker/Events/UserDeleted.php
+++ b/ProcessMaker/Events/UserDeleted.php
@@ -35,7 +35,7 @@ public function getData(): array
return [
'firstname' => $this->user->getAttribute('firstname'),
'lastname' => $this->user->getAttribute('lastname'),
- 'deleted_at' => Carbon::now()
+ 'deleted_at' => Carbon::now(),
];
}
diff --git a/ProcessMaker/Events/UserGroupMembershipUpdated.php b/ProcessMaker/Events/UserGroupMembershipUpdated.php
index ba5a0a32f9..926204632e 100644
--- a/ProcessMaker/Events/UserGroupMembershipUpdated.php
+++ b/ProcessMaker/Events/UserGroupMembershipUpdated.php
@@ -12,7 +12,9 @@ class UserGroupMembershipUpdated implements SecurityLogEventInterface
use Dispatchable;
private User $userUpdated;
+
private array $data;
+
private array $changes;
/**
@@ -25,16 +27,16 @@ public function __construct(array $data, User $userUpdated)
$this->userUpdated = $userUpdated;
$this->buildData($data);
$this->changes = [
- 'user' => $userUpdated->id,
- 'groups' => $data
+ 'user' => $userUpdated->id,
+ 'groups' => $data,
];
}
/**
* Building the data
*/
- public function buildData($data) {
-
+ public function buildData($data)
+ {
$groupsDeleted = [];
$groupsAdded = [];
@@ -43,7 +45,7 @@ public function buildData($data) {
$group = Group::findOrFail($groupId);
$groupsAdded[] = [
'link' => route('groups.edit', $group),
- 'label' => $group->name
+ 'label' => $group->name,
];
}
}
@@ -52,7 +54,7 @@ public function buildData($data) {
$group = Group::findOrFail($groupId);
$groupsDeleted[] = [
'link' => route('groups.edit', $group),
- 'label' => $group->name
+ 'label' => $group->name,
];
}
}
@@ -60,29 +62,29 @@ public function buildData($data) {
$this->data = [
'user' => [
'link' => route('users.edit', $this->userUpdated),
- 'label' => $this->userUpdated->username
- ]
+ 'label' => $this->userUpdated->username,
+ ],
];
if (!empty($groupsAdded)) {
$this->data['+ groups'] = $groupsAdded;
- };
+ }
if (!empty($groupsDeleted)) {
$this->data['- groups'] = $groupsDeleted;
- };
+ }
}
-
+
/**
- * Return event data
+ * Return event data
*/
public function getData(): array
{
return $this->data;
}
-
+
/**
- * Return event changes
+ * Return event changes
*/
public function getChanges(): array
{
diff --git a/ProcessMaker/Exception/Handler.php b/ProcessMaker/Exception/Handler.php
index a1a7301767..721f66f31c 100644
--- a/ProcessMaker/Exception/Handler.php
+++ b/ProcessMaker/Exception/Handler.php
@@ -52,7 +52,8 @@ public function report(Throwable $exception)
if ($exception instanceof \Illuminate\Auth\Access\AuthorizationException) {
try {
UnauthorizedAccessAttempt::dispatch();
- } catch (\Exception $e){}
+ } catch (\Exception $e) {
+ }
}
parent::report($exception);
}
diff --git a/ProcessMaker/Helpers/SensitiveDataHelper.php b/ProcessMaker/Helpers/SensitiveDataHelper.php
index d3b4c517a8..d4b8122f17 100644
--- a/ProcessMaker/Helpers/SensitiveDataHelper.php
+++ b/ProcessMaker/Helpers/SensitiveDataHelper.php
@@ -6,7 +6,7 @@ class SensitiveDataHelper
{
const SENSITIVE_KEYS = [
'password',
- 'idp.client_secret'
+ 'idp.client_secret',
];
const MASK = '*';
@@ -17,7 +17,7 @@ public static function parseArray(array|object $data)
foreach ($data as $key => $value) {
if (is_array($value) || is_object($value)) {
$data[$key] = static::parseArray($value);
- } elseif(is_string($value) && static::isSensitiveKey($key)) {
+ } elseif (is_string($value) && static::isSensitiveKey($key)) {
$data[$key] = static::parseString($value);
} else {
$data[$key] = $value;
@@ -27,7 +27,7 @@ public static function parseArray(array|object $data)
foreach ($data as $key => $value) {
if (is_array($value) || is_object($value)) {
$data->$key = static::parseArray($value);
- } elseif(is_string($value) && static::isSensitiveKey($key)) {
+ } elseif (is_string($value) && static::isSensitiveKey($key)) {
$data->$key = static::parseString($value);
} else {
$data->$key = $value;
@@ -43,12 +43,14 @@ public static function isSensitiveKey($key)
$key = strtolower($key);
$key = str_replace('+ ', '', $key);
$key = str_replace('- ', '', $key);
+
return in_array($key, static::SENSITIVE_KEYS);
}
public static function parseString($str)
{
$len = strlen($str);
+
return $len > 0 ? str_repeat(static::MASK, $len) : $str;
}
}
diff --git a/ProcessMaker/Http/Controllers/Api/CssOverrideController.php b/ProcessMaker/Http/Controllers/Api/CssOverrideController.php
index 956cbc53ca..5060ee62e9 100755
--- a/ProcessMaker/Http/Controllers/Api/CssOverrideController.php
+++ b/ProcessMaker/Http/Controllers/Api/CssOverrideController.php
@@ -92,9 +92,9 @@ public function store(Request $request)
$setting->fill($request->input());
$original = array_intersect_key($setting->getOriginal(), $setting->getDirty());
-
+
$setting->saveOrFail();
-
+
$footer = $this->setLoginFooter($request);
$altText = $this->setAltText($request);
@@ -104,9 +104,9 @@ public function store(Request $request)
$changes = [];
if (isset($setting->getChanges()['config'])) {
- $changes = (array)json_decode($setting->getChanges()['config']);
+ $changes = (array) json_decode($setting->getChanges()['config']);
}
-
+
if (!empty($changes)) {
event(new CustomizeUiUpdated($original, array_merge($footer, $altText, $changes), $setting->getChanges()['updated_at']));
}
diff --git a/ProcessMaker/Http/Controllers/Api/GroupMemberController.php b/ProcessMaker/Http/Controllers/Api/GroupMemberController.php
index c3dde6943f..2dbaf1a7e3 100644
--- a/ProcessMaker/Http/Controllers/Api/GroupMemberController.php
+++ b/ProcessMaker/Http/Controllers/Api/GroupMemberController.php
@@ -135,7 +135,7 @@ public function store(Request $request)
$group_member->member()->associate($member);
$group_member->saveOrFail();
- event(new GroupUsersUpdated($group->id , $request->input('member_id'), GroupUsersUpdated::ADDED, $request->input('member_type')));
+ event(new GroupUsersUpdated($group->id, $request->input('member_id'), GroupUsersUpdated::ADDED, $request->input('member_type')));
return response(new GroupMemberResource($group_member), 201);
}
@@ -206,8 +206,8 @@ public function destroy(GroupMember $group_member)
{
$group_member->delete();
+ event(new GroupUsersUpdated($group_member->group_id, $group_member->member_id, GroupUsersUpdated::DELETED, $group_member->member_type));
- event(new GroupUsersUpdated($group_member->group_id , $group_member->member_id, GroupUsersUpdated::DELETED, $group_member->member_type));
return response([], 204);
}
diff --git a/ProcessMaker/Http/Controllers/Api/PermissionController.php b/ProcessMaker/Http/Controllers/Api/PermissionController.php
index 4bb1ace61e..61a21e3b7f 100644
--- a/ProcessMaker/Http/Controllers/Api/PermissionController.php
+++ b/ProcessMaker/Http/Controllers/Api/PermissionController.php
@@ -104,7 +104,7 @@ public function update(Request $request)
// Call Event to store Permissions Changes in Log
PermissionUpdated::dispatch($requestPermissions, $originalPermissionNames, $entity->is_administrator, $request->input('user_id'));
-
+
//Sync the entity's permissions with the database
$entity->permissions()->sync($permissions->pluck('id')->toArray());
diff --git a/ProcessMaker/Http/Controllers/Api/ProcessCategoryController.php b/ProcessMaker/Http/Controllers/Api/ProcessCategoryController.php
index 509ca22dbe..a1454d8b7d 100644
--- a/ProcessMaker/Http/Controllers/Api/ProcessCategoryController.php
+++ b/ProcessMaker/Http/Controllers/Api/ProcessCategoryController.php
@@ -149,7 +149,7 @@ public function store(Request $request)
$request->validate(ProcessCategory::rules());
$category = new ProcessCategory();
$category->fill($request->json()->all());
-
+
$category->saveOrFail();
// Call Event to store Category Created in Log
@@ -201,6 +201,7 @@ public function update(Request $request, ProcessCategory $processCategory)
//call Event to store Category Changes in Log
CategoryUpdated::dispatch($processCategory, $changes, $original);
+
return new Resource($processCategory);
}
@@ -234,7 +235,6 @@ public function update(Request $request, ProcessCategory $processCategory)
*/
public function destroy(ProcessCategory $processCategory)
{
-
if ($processCategory->processes->count() !== 0) {
return response(
[
diff --git a/ProcessMaker/Http/Controllers/Api/ProcessController.php b/ProcessMaker/Http/Controllers/Api/ProcessController.php
index cd1efe76c1..9d2869f57f 100644
--- a/ProcessMaker/Http/Controllers/Api/ProcessController.php
+++ b/ProcessMaker/Http/Controllers/Api/ProcessController.php
@@ -222,6 +222,12 @@ public function store(Request $request)
{
$request->validate(Process::rules());
$data = $request->all();
+
+ // If bpmn exists (from Generative AI)
+ if ($request->input('bpmn')) {
+ $data['bpmn'] = $request->input('bpmn');
+ }
+
// Validate if exists file bpmn
if ($request->has('file')) {
$data['bpmn'] = $request->file('file')->get();
@@ -362,6 +368,7 @@ public function update(Request $request, Process $process)
//Call Event to Log Template Changes
TemplateUpdated::dispatch([], [], true);
+
return new Resource($process->refresh());
} catch (\Exception $error) {
return ['error' => $error->getMessage()];
@@ -1036,6 +1043,7 @@ public function downloadBpmn(Request $request, Process $process)
{
$bpmn = $process->bpmn;
$filename = 'bpmnProcess.bpmn';
+
return response()->streamDownload(function () use ($bpmn) {
echo $bpmn;
}, $filename);
diff --git a/ProcessMaker/Http/Controllers/Api/ScreenController.php b/ProcessMaker/Http/Controllers/Api/ScreenController.php
index 655f69d08b..133ace90d9 100644
--- a/ProcessMaker/Http/Controllers/Api/ScreenController.php
+++ b/ProcessMaker/Http/Controllers/Api/ScreenController.php
@@ -219,6 +219,7 @@ public function store(Request $request)
$screen->saveOrFail();
//Call event to store New Screen data in LOG
ScreenCreated::dispatch($newScreen->getAttributes());
+
return new ApiResource($screen);
}
@@ -407,7 +408,6 @@ public function duplicate(Screen $screen, Request $request)
*/
public function destroy(Screen $screen)
{
-
$screen->delete();
//Call new event to store changes in LOG
ScreenDeleted::dispatch($screen);
diff --git a/ProcessMaker/Http/Controllers/Api/ScriptExecutorController.php b/ProcessMaker/Http/Controllers/Api/ScriptExecutorController.php
index b7b45db400..c6b47c0c80 100644
--- a/ProcessMaker/Http/Controllers/Api/ScriptExecutorController.php
+++ b/ProcessMaker/Http/Controllers/Api/ScriptExecutorController.php
@@ -168,13 +168,13 @@ public function update(Request $request, ScriptExecutor $scriptExecutor)
{
$this->checkAuth($request);
$request->validate(ScriptExecutor::rules());
-
+
$original_values = $scriptExecutor->getAttributes();
-
+
$scriptExecutor->update(
$request->only($scriptExecutor->getFillable())
);
-
+
ScriptExecutorUpdated::dispatch($scriptExecutor->id, $original_values, $scriptExecutor->getChanges());
BuildScriptExecutor::dispatch($scriptExecutor->id, $request->user()->id);
diff --git a/ProcessMaker/Http/Controllers/Api/SecurityLogController.php b/ProcessMaker/Http/Controllers/Api/SecurityLogController.php
index 956ab50083..08843563a9 100644
--- a/ProcessMaker/Http/Controllers/Api/SecurityLogController.php
+++ b/ProcessMaker/Http/Controllers/Api/SecurityLogController.php
@@ -140,14 +140,15 @@ public function store(Request $request)
private function download(Request $request, User $user = null)
{
$request->validate([
- 'format' => 'required|string|in:xml,csv'
+ 'format' => 'required|string|in:xml,csv',
]);
sleep(1);
$sessionUser = Auth::user();
DownloadSecurityLog::dispatch($sessionUser, $request->input('format'), $user ? $user->id : null)
->delay(now()->addSeconds(5));
+
return response()->json([
- 'message' => __('The log file is being prepared and will be sent to your email as soon as it is ready.')
+ 'message' => __('The log file is being prepared and will be sent to your email as soon as it is ready.'),
], 200);
}
diff --git a/ProcessMaker/Http/Controllers/Api/TemplateController.php b/ProcessMaker/Http/Controllers/Api/TemplateController.php
index aef5cb07b4..9cb6fc610a 100644
--- a/ProcessMaker/Http/Controllers/Api/TemplateController.php
+++ b/ProcessMaker/Http/Controllers/Api/TemplateController.php
@@ -8,8 +8,8 @@
use ProcessMaker\Events\TemplateUpdated;
use ProcessMaker\Http\Controllers\Controller;
use ProcessMaker\Http\Resources\TemplateCollection;
-use ProcessMaker\Models\ProcessTemplates;
use ProcessMaker\Models\Process;
+use ProcessMaker\Models\ProcessTemplates;
use ProcessMaker\Models\Template;
class TemplateController extends Controller
@@ -148,6 +148,7 @@ public function delete(string $type, Request $request)
$response = $this->template->deleteTemplate($type, $request);
//Call event to Store Template Deleted on LOG
TemplateDeleted::dispatch($template);
+
return $response;
}
diff --git a/ProcessMaker/Http/Controllers/Api/UserController.php b/ProcessMaker/Http/Controllers/Api/UserController.php
index 16b8ebe548..405dae7054 100644
--- a/ProcessMaker/Http/Controllers/Api/UserController.php
+++ b/ProcessMaker/Http/Controllers/Api/UserController.php
@@ -8,8 +8,8 @@
use Illuminate\Support\Facades\Hash;
use ProcessMaker\Events\UserCreated;
use ProcessMaker\Events\UserDeleted;
-use ProcessMaker\Events\UserUpdated;
use ProcessMaker\Events\UserGroupMembershipUpdated;
+use ProcessMaker\Events\UserUpdated;
use ProcessMaker\Exception\ReferentialIntegrityException;
use ProcessMaker\Http\Controllers\Controller;
use ProcessMaker\Http\Resources\ApiCollection;
@@ -207,7 +207,7 @@ public function show(User $user)
return new UserResource($user);
}
-
+
/**
* Return the user's pinned nodes.
*
@@ -250,7 +250,6 @@ public function getPinnnedControls(User $user)
: [];
}
-
/**
* Update a user
*
@@ -353,7 +352,7 @@ public function updatePinnedControls(User $user, Request $request)
if (!$user->can('edit', $user)) {
throw new AuthorizationException(__('Not authorized to update this user.'));
}
-
+
if ($request->has('pinnedNodes')) {
$meta = $user->meta ? (array) $user->meta : [];
$meta['pinnedControls'] = $request->get('pinnedNodes');
@@ -361,6 +360,7 @@ public function updatePinnedControls(User $user, Request $request)
}
$user->saveOrFail();
+
return response([], 204);
}
@@ -422,6 +422,7 @@ public function updateGroups(User $user, Request $request)
return response([], 400);
}
event(new UserGroupMembershipUpdated($data, $user));
+
return response([], 204);
}
diff --git a/ProcessMaker/Http/Controllers/Auth/ClientController.php b/ProcessMaker/Http/Controllers/Auth/ClientController.php
index 5cf8b1777e..3d716912ce 100644
--- a/ProcessMaker/Http/Controllers/Auth/ClientController.php
+++ b/ProcessMaker/Http/Controllers/Auth/ClientController.php
@@ -77,7 +77,7 @@ public function update(Request $request, $clientId)
}
$original_values = $client->getAttributes();
-
+
$this->validate($request);
$personalAccess = in_array('personal_access_client', $request->types);
@@ -90,7 +90,7 @@ public function update(Request $request, $clientId)
'personal_access_client' => $personalAccess,
'password_client' => $password,
]);
-
+
$original = array_intersect_key($client->getOriginal(), $client->getDirty());
$client->save();
diff --git a/ProcessMaker/Http/Controllers/Process/ModelerController.php b/ProcessMaker/Http/Controllers/Process/ModelerController.php
index 27162ed2da..747717cb1f 100644
--- a/ProcessMaker/Http/Controllers/Process/ModelerController.php
+++ b/ProcessMaker/Http/Controllers/Process/ModelerController.php
@@ -4,6 +4,7 @@
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Http;
use ProcessMaker\Events\ModelerStarting;
use ProcessMaker\Http\Controllers\Controller;
use ProcessMaker\Managers\ModelerManager;
@@ -91,4 +92,35 @@ public function inflight(ModelerManager $manager, Process $process, Request $req
'requestId' => $request->request_id,
]);
}
+
+ /**
+ * Invokes the Modeler for In-flight Process Map rendering for ai generative.
+ */
+ public function inflightProcessAi(ModelerManager $manager, $promptVersionId, Request $request)
+ {
+ $aiMicroserviceHost = config('app.ai_microservice_host');
+ $url = $aiMicroserviceHost . '/pm/getPromptVersion';
+ $headers = [
+ 'Authorization' => 'token',
+ ];
+
+ $params = [
+ 'promptVersionId' => $promptVersionId,
+ ];
+
+ $promptVersion = Http::withHeaders($headers)->post($url, $params);
+
+ $bpmn = '';
+
+ if (array_key_exists('version', $promptVersion->json())) {
+ $bpmn = $promptVersion->json()['version']['bpmn'];
+ }
+
+ event(new ModelerStarting($manager));
+
+ return view('processes.modeler.inflight-generative-ai', [
+ 'manager' => $manager,
+ 'bpmn' => $bpmn,
+ ]);
+ }
}
diff --git a/ProcessMaker/Jobs/DownloadSecurityLog.php b/ProcessMaker/Jobs/DownloadSecurityLog.php
index f73bbbe3bf..4403455969 100644
--- a/ProcessMaker/Jobs/DownloadSecurityLog.php
+++ b/ProcessMaker/Jobs/DownloadSecurityLog.php
@@ -18,7 +18,9 @@ class DownloadSecurityLog implements ShouldQueue
SerializesModels;
private User $user;
+
private string $format;
+
private ?int $userId;
/**
@@ -48,7 +50,7 @@ public function handle()
if (mt_rand(1, 10) <= 8) {
event(new SecurityLogDownloadJobCompleted($this->user, true, __('Click on the link and download the file. This link will be available until midnight tonight.'), 'http://processmaker.com/?download=true'));
} else {
- event (new SecurityLogDownloadJobCompleted($this->user, false, __('Sorry, it was not possible to generate the log file. Please contact the administrator.')));
+ event(new SecurityLogDownloadJobCompleted($this->user, false, __('Sorry, it was not possible to generate the log file. Please contact the administrator.')));
}
}
}
diff --git a/ProcessMaker/Listeners/SecurityLogger.php b/ProcessMaker/Listeners/SecurityLogger.php
index 418e8d151c..aa8f68e480 100644
--- a/ProcessMaker/Listeners/SecurityLogger.php
+++ b/ProcessMaker/Listeners/SecurityLogger.php
@@ -35,7 +35,7 @@ public function handle($event)
'meta' => $this->getMeta(),
'user_id' => isset($event->user) ? $event->user->id : Auth::id(),
'data' => $data ? SensitiveDataHelper::parseArray($data) : null,
- 'changes' => $changes ? SensitiveDataHelper::parseArray($changes) : null
+ 'changes' => $changes ? SensitiveDataHelper::parseArray($changes) : null,
]);
} elseif (array_key_exists($class, $this->eventTypes)) {
$eventType = $this->eventTypes[$class];
@@ -43,7 +43,7 @@ public function handle($event)
'event' => $eventType,
'ip' => request()->ip(),
'meta' => $this->getMeta(),
- 'user_id' => isset($event->user) ? $event->user->id : null
+ 'user_id' => isset($event->user) ? $event->user->id : null,
]);
}
}
diff --git a/ProcessMaker/Models/User.php b/ProcessMaker/Models/User.php
index 76227a9b5e..d6d2167274 100644
--- a/ProcessMaker/Models/User.php
+++ b/ProcessMaker/Models/User.php
@@ -284,7 +284,8 @@ public function getAvatar()
{
$media = $this->getMedia(self::COLLECTION_PROFILE);
$lastUpload = $media->last();
- $url = $lastUpload ? $lastUpload->getFullUrl() : "";
+ $url = $lastUpload ? $lastUpload->getFullUrl() : '';
+
return $url;
}
diff --git a/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php b/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php
index f3b14b6b55..d82eaa1b7d 100644
--- a/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php
+++ b/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php
@@ -15,6 +15,7 @@
class WorkflowManagerRabbitMq extends WorkflowManagerDefault implements WorkflowManagerInterface
{
const ACTION_START_PROCESS = 'START_PROCESS';
+
const ACTION_COMPLETE_TASK = 'COMPLETE_TASK';
/**
@@ -73,7 +74,7 @@ public function triggerStartEvent(Definitions $definitions, StartEventInterface
'callable_id' => $request->callable_id,
'data' => $request->data,
'tokens' => [],
- ]
+ ],
],
],
]);
@@ -129,9 +130,9 @@ public function completeTask(Definitions $definitions, ExecutionInstanceInterfac
'callable_id' => $instance->callable_id,
'data' => $instance->data,
'tokens' => $tokensRows,
- ]
+ ],
],
- ]
+ ],
]);
}
diff --git a/ProcessMaker/Nayra/MessageBrokers/Service.php b/ProcessMaker/Nayra/MessageBrokers/Service.php
index 874baf0ab7..71d7a70776 100644
--- a/ProcessMaker/Nayra/MessageBrokers/Service.php
+++ b/ProcessMaker/Nayra/MessageBrokers/Service.php
@@ -27,5 +27,5 @@ public static function create()
}
return $service;
- }
+ }
}
diff --git a/ProcessMaker/Nayra/MessageBrokers/ServiceKafka.php b/ProcessMaker/Nayra/MessageBrokers/ServiceKafka.php
index 6536ed9c23..7685444eec 100644
--- a/ProcessMaker/Nayra/MessageBrokers/ServiceKafka.php
+++ b/ProcessMaker/Nayra/MessageBrokers/ServiceKafka.php
@@ -2,8 +2,8 @@
namespace ProcessMaker\Nayra\MessageBrokers;
-use Junges\Kafka\Facades\Kafka;
use Junges\Kafka\Contracts\KafkaConsumerMessage;
+use Junges\Kafka\Facades\Kafka;
use ProcessMaker\Nayra\Repositories\EntityRepositoryFactory;
class ServiceKafka
@@ -61,7 +61,7 @@ public function receiveMessage(string $queueName): string
public function worker()
{
// Create Kafka consumer
- $consumer = Kafka::createConsumer([self::QUEUE_NAME])->withHandler(function(KafkaConsumerMessage $message) {
+ $consumer = Kafka::createConsumer([self::QUEUE_NAME])->withHandler(function (KafkaConsumerMessage $message) {
// Get transactions
$transactions = $message->getBody();
diff --git a/ProcessMaker/Nayra/MessageBrokers/ServiceRabbitMq.php b/ProcessMaker/Nayra/MessageBrokers/ServiceRabbitMq.php
index 0ea16bd9fa..71c56cf9e4 100644
--- a/ProcessMaker/Nayra/MessageBrokers/ServiceRabbitMq.php
+++ b/ProcessMaker/Nayra/MessageBrokers/ServiceRabbitMq.php
@@ -9,9 +9,11 @@
class ServiceRabbitMq
{
const QUEUE_NAME_CONSUME = 'nayra-store';
+
const QUEUE_NAME_PUBLISH = 'requests';
private $connection;
+
private $channel;
/**
@@ -31,7 +33,6 @@ public function connect(): void
$this->connection = new AMQPStreamConnection($rabbitMqHost, $rabbitMqPort, $rabbitMqLogin, $rabbitMqPassword);
$this->channel = $this->connection->channel();
-
// Set channel config
$this->channel->queue_declare(self::QUEUE_NAME_PUBLISH, false, true, false, false);
$this->channel->queue_declare(self::QUEUE_NAME_CONSUME, false, true, false, false);
diff --git a/ProcessMaker/Nayra/Repositories/ProcessRequestRepository.php b/ProcessMaker/Nayra/Repositories/ProcessRequestRepository.php
index 99e3ceb48c..fef5f900e0 100644
--- a/ProcessMaker/Nayra/Repositories/ProcessRequestRepository.php
+++ b/ProcessMaker/Nayra/Repositories/ProcessRequestRepository.php
@@ -40,6 +40,7 @@ public function create(array $transaction): ? Model
} catch (Exception $e) {
// Log the error
Log::error("Cannot create request: {$e->getMessage()}");
+
return null;
}
}
@@ -79,6 +80,7 @@ public function update(array $transaction): ? Model
} catch (Exception $e) {
// Log the error
Log::error("Cannot update request: {$e->getMessage()}");
+
return null;
}
}
diff --git a/ProcessMaker/Nayra/Repositories/ProcessRequestTokenRepository.php b/ProcessMaker/Nayra/Repositories/ProcessRequestTokenRepository.php
index 799ac7ae7e..e3cd1876f8 100644
--- a/ProcessMaker/Nayra/Repositories/ProcessRequestTokenRepository.php
+++ b/ProcessMaker/Nayra/Repositories/ProcessRequestTokenRepository.php
@@ -62,6 +62,7 @@ public function create(array $transaction): ? Model
} catch (Exception $e) {
// Log the error
Log::error("Cannot create token: {$e->getMessage()}");
+
return null;
}
}
@@ -93,6 +94,7 @@ public function update(array $transaction): ? Model
} catch (Exception $e) {
// Log the error
Log::error("Cannot update token: {$e->getMessage()}");
+
return null;
}
}
diff --git a/ProcessMaker/SanitizeHelper.php b/ProcessMaker/SanitizeHelper.php
index 625d5f019d..52ad22c02d 100644
--- a/ProcessMaker/SanitizeHelper.php
+++ b/ProcessMaker/SanitizeHelper.php
@@ -197,7 +197,7 @@ private static function getRichTextElements($items, $parent = null)
$elements = array_merge($elements, self::getRichTextElements($item['items'], ($parent ? $parent . '.' . $item['config']['name'] : $item['config']['name'])));
} elseif (isset($item['component']) && $item['component'] === 'FormTextArea' && isset($item['config']['richtext']) && $item['config']['richtext'] === true) {
$elements[] = ($parent ? $parent . '.' . $item['config']['name'] : $item['config']['name']);
- // Inside a table ..
+ // Inside a table ..
} elseif ($item['component'] == 'FormMultiColumn') {
foreach ($item['items'] as $cell) {
if (
diff --git a/ProcessMaker/Traits/FormatSecurityLogChanges.php b/ProcessMaker/Traits/FormatSecurityLogChanges.php
index 38bfdc8587..9fe3155329 100644
--- a/ProcessMaker/Traits/FormatSecurityLogChanges.php
+++ b/ProcessMaker/Traits/FormatSecurityLogChanges.php
@@ -16,9 +16,10 @@ public function formatChanges(array $changes, array $original)
$formatted['+ ' . $translated] = is_array($newValue) || is_object($newValue) ? json_encode($newValue) : $newValue;
if (isset($original[$key])) {
$oldValue = $original[$key];
- $formatted['- ' . $translated] = is_array($oldValue) || is_object($oldValue) ? json_encode($oldValue) : $oldValue;;
+ $formatted['- ' . $translated] = is_array($oldValue) || is_object($oldValue) ? json_encode($oldValue) : $oldValue;
}
}
+
return $formatted;
}
-}
\ No newline at end of file
+}
diff --git a/composer.json b/composer.json
index 5d114644d5..ab87c4915c 100644
--- a/composer.json
+++ b/composer.json
@@ -108,6 +108,7 @@
"docker-executor-node-ssr": "1.2.1",
"package-actions-by-email": "1.12.0",
"package-advanced-user-manager": "1.5.0",
+ "package-ai": "0.1.1",
"package-auth": "1.11.1",
"package-collections": "2.10.0",
"package-comments": "1.6.0",
diff --git a/composer.lock b/composer.lock
index 4ff257a3d0..c7cc332d30 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "8917da804464a2aa23f94fcf3ffe1fc0",
+ "content-hash": "46943a1d448816e560dfac5b4bb6d2c5",
"packages": [
{
"name": "asm89/stack-cors",
diff --git a/config/app.php b/config/app.php
index 118cbe545b..dc5c365549 100644
--- a/config/app.php
+++ b/config/app.php
@@ -98,6 +98,9 @@
// Allows to detect if OpenAI is enabled or not
'open_ai_nlq_to_pmql' => env('OPEN_AI_NLQ_TO_PMQL_ENABLED', false) && env('OPEN_AI_SECRET', false),
+ // Microservice AI Host
+ 'ai_microservice_host' => env('AI_MICROSERVICE_HOST'),
+
// Message broker driver to use in Workflow Manager
'message_broker_driver' => env('MESSAGE_BROKER_DRIVER', 'default'),
diff --git a/config/kafka.php b/config/kafka.php
index 8def8c1caf..8183934398 100644
--- a/config/kafka.php
+++ b/config/kafka.php
@@ -14,7 +14,7 @@
*/
'consumer_group_id' => env('KAFKA_CONSUMER_GROUP_ID', 'PM4-core-group'),
- 'consumer_timeout_ms' => env("KAFKA_CONSUMER_DEFAULT_TIMEOUT", 2000),
+ 'consumer_timeout_ms' => env('KAFKA_CONSUMER_DEFAULT_TIMEOUT', 2000),
/*
| After the consumer receives its assignment from the coordinator,
diff --git a/resources/js/components/templates/ButtonCard.vue b/resources/js/components/templates/ButtonCard.vue
new file mode 100644
index 0000000000..7540a5ebe6
--- /dev/null
+++ b/resources/js/components/templates/ButtonCard.vue
@@ -0,0 +1,120 @@
+
+ {{ button.helperDescription }}{{ button.title }}
+ {{ button.helperTitle }}
+