Skip to content

fix(FOUR-32830): accept array form_data in rule expression assignees - #9008

Open
gproly wants to merge 3 commits into
developfrom
bugfix/FOUR-32830
Open

fix(FOUR-32830): accept array form_data in rule expression assignees#9008
gproly wants to merge 3 commits into
developfrom
bugfix/FOUR-32830

Conversation

@gproly

@gproly gproly commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

getAssigneesFromExpression now handles array input from POST users_task_count, fixing 500 errors when REASSIGN_RESTRICT_TO_ASSIGNABLE_USERS is enabled.

https://processmaker.atlassian.net/browse/FOUR-32830

ci:deploy

getAssigneesFromExpression now handles array input from POST
users_task_count, fixing 500 errors when REASSIGN_RESTRICT_TO_ASSIGNABLE_USERS is enabled.

https://processmaker.atlassian.net/browse/FOUR-32830
Handle array input from POST users_task_count to prevent TypeError
when REASSIGN_RESTRICT_TO_ASSIGNABLE_USERS is enabled.

https://processmaker.atlassian.net/browse/FOUR-32830
@nolanpro

Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-fe9ffd1065.engk8s.processmaker.net

…ay form_data

Accept array form_data in getAssigneesFromExpression to prevent
TypeError on users_task_count when REASSIGN_RESTRICT_TO_ASSIGNABLE_USERS is enabled.
Expand group assignees via getConsolidatedUsers, flatten manager_id, and evaluate
reassignment rules using BPMN assignment type instead of getAssignmentRule().

https://processmaker.atlassian.net/browse/FOUR-32830
@cursor

cursor Bot commented Sep 8, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes who appears in reassign user pickers for rule-expression tasks (group expansion and assignment detection); limited to assignable-user restriction flows but affects task assignment UX.

Overview
Fixes 500 errors on POST /users_task_count when reassign_restrict_to_assignable_users is on and the client sends form_data as a JSON object (not a string).

getAssigneesFromExpression now accepts string or array form_data, treats missing assignmentRules as [], and builds the assignable user list by expanding group rules to member users and including process managers (including multi-manager manager_id).

getUsersTaskCount checks the BPMN task assignment property (rule_expression / process_variable) instead of getAssignmentRule(), so expression-based filtering runs when the task is configured for rule expressions.

Feature and model tests cover user/group rule-expression filtering and array vs JSON-string form_data.

Reviewed by Cursor Bugbot for commit a84c9e5. Bugbot is set up for automated code reviews on this repo. Configure here.

@decisions-sonarqube

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a84c9e5. Configure here.


foreach ((array) ($this->process->manager_id ?? []) as $managerId) {
if (!empty($managerId) && is_numeric($managerId)) {
$userIds[$managerId] = $managerId;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Group expansion drops assignable users

High Severity

getConsolidatedUsers reindexes $userIds with sequential keys via array_merge, then later keyed writes for user assignees and manager_id overwrite group members at those indexes. With REASSIGN_RESTRICT_TO_ASSIGNABLE_USERS enabled by default, valid reassignment candidates disappear from the list.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a84c9e5. Configure here.

$include_ids[] = $manager_id;
foreach ($assignments as $assignment) {
if (!in_array($assignment['assignee'], $assigneeIds, true)) {
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assignee match ignores rule identity

Medium Severity

The second pass treats every assignment whose assignee appears in assigneeIds as a match. User and group IDs use separate sequences, so an unmatched group rule can expand when a user rule with the same numeric ID matched, or the reverse.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a84c9e5. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants