Set Admin User as Default run_as_user_id When Importing Scripts#6208
Set Admin User as Default run_as_user_id When Importing Scripts#6208ryancooley merged 2 commits intonextfrom
Conversation
eiresendez
left a comment
There was a problem hiding this comment.
@sanjacornelius I think there's a potential issue in !is_null($scriptUser->id). For instance, if $scriptUser is null, trying to access id would result in WARNING Attempt to read property "id" on null.
Maybe using the nullsafe operator is a safe way to handle that:
$this->model->run_as_user_id = $scriptUser?->id ?? User::where('is_administrator', true)->first()->id;
Great idea!! I will implement thank you!! |
|

0.0% Coverage on New Code
0.0% Duplication on New Code
Issue & Reproduction Steps
This PR addresses an issue discovered during the import of scripts from Guided Templates where scripts lacking a
run_as_user_idcaused aA user is required to run scripts. error when running the Re-run Wizard process. To resolve this, the PR implements setting the admin user as the defaultrun_as_user_idwhen importing such scripts.How to Test
php artisan processmaker:sync-guided-templates._configuration_error_node_212are present.Example Error that was previously returned:
Related Tickets & Packages
ci:next
Code Review Checklist