Skip to content

Remove dependent assignment when not on target instance#5099

Merged
ryancooley merged 1 commit into
developfrom
bugfix/FOUR-9747
Aug 4, 2023
Merged

Remove dependent assignment when not on target instance#5099
ryancooley merged 1 commit into
developfrom
bugfix/FOUR-9747

Conversation

@nolanpro
Copy link
Copy Markdown
Contributor

@nolanpro nolanpro commented Aug 4, 2023

Issue & Reproduction Steps

See description in Jira issue

If we export a process with a script, the script will have a "Run script as" user assigned. Users are not exported. When we import the process, the system searches for a user with the same UUID, email, or username. If found, it sets the "Run script as" user to that user. However, if the user is not found in the target instance, it does not change the "Run script as" user id. This could create a problem if the source instance had a Run script as user: bob with the id 5 and the target instance does not have bob, but does have the user alice and happens to have the same ID: 5. When the script imports, since it does not change the "Run script as" user id, the script will be accidentally assigned to alice My suggestion is that we set the "Run script as" user to null if the user does not exist in the target instance

Solution

  • Remove assignments for script's user, process's subprocesses, and process's task assignments when they do not exist on the the target instance

How to Test

  • Create a regular user
  • Create a process and the set the process manager to the admin user
  • Create a form task and assign it to the regular user
  • Export the process
  • Import on another instance that does not have the regular user (or has a clean database).
  • Run the process. The task should automatically assign to the Process Manager (admin user) because the user assignment is now blank. Before this fix, you would get an error Undefined array key "assign_to" if the user did not exist, or, if a different user exists with the same ID, it would wrongfully be assigned to that user.

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@ryancooley ryancooley merged commit cb2ffc0 into develop Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants