Repository navigation
FOUR-33773 | Add Out of Office Status and Delegation for Users With Edit Personal Profile Permission - #9098
FOUR-33773 | Add Out of Office Status and Delegation for Users With Edit Personal Profile Permission#9098mcraeteisha wants to merge 12 commits into
Conversation
This change enables self-service profile updates to set a valid delegation user and status values without exposing server-managed fields. The API now restricts editable statuses to the account owner’s allowed set, preserves current admin-assigned values when needed, clears invalid delegation references, and validates delegation ownership and non-system/non-deleted users. The profile editor also sends a filtered payload for self-service edits, and tests cover successful out-of-office delegation updates plus rejection of blocked/scheduled statuses.
PR SummaryMedium Risk Overview Task assignment and reassignment now route Out-of-Office work only to replacements who are still ACTIVE ( The profile UI sends a trimmed Reviewed by Cursor Bugbot for commit 0e25936. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net |
|
QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net |
eiresendez
left a comment
There was a problem hiding this comment.
Approved! I'm just adding a possible edge case but not a blocker, if replacements are required to remain assignable.
Ensure assignments for out-of-office users only resolve to active, valid replacements. This adds active delegation checks and assignee validation to task assignment flows, updates the raw repository queries to ignore soft-deleted/inactive delegation targets, and covers the behavior with regression tests for variable-based task assignment and user delegation rules.
When an assignment resolves to a user who cannot take the task, the token now falls back to the process manager instead of leaving the task unassigned. This also clears stale user relationships before notifying reassignees and adds a feature test covering inactive, out-of-office, and empty replacement cases.
|
QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net |
This change restricts delegation assignment validation to non-system, non-deleted, ACTIVE users and clears stale delegation_user_id values for missing, deleted, system, or inactive delegates. It also fixes assignee resolution during escalation so the resolved manager user is used consistently before accepting the final assignee.
|
QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net |
|
QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3dbaf73. Configure here.
|
|
||
| // Send a notification to the user | ||
| $notification = new TaskReassignmentNotification($this); | ||
| $this->user->notify($notification); |
There was a problem hiding this comment.
Reassign persists original user data
Medium Severity
When reassignTo() now falls back to the Process Manager because nobody can take the task, reassign() still calls persistUserData() with the original $toUserId. Request _user then keeps the Out of Office or unavailable user while the token is assigned to the manager, so later screens, scripts, and _user-based notifications can run as the wrong person. The same method already uses the resolved user for the reassignment email.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 3dbaf73. Configure here.
Extract self-service validation, password hashing, email change checks, save, and avatar upload into helpers so the Quality Gate stops failing on S3776. Co-authored-by: Cursor <cursoragent@cursor.com>
| $rules['meta'] = ['sometimes', 'array']; | ||
| $rules['meta.disableRecommendations'] = ['sometimes', 'boolean']; | ||
| $rules['status'] = ['required', Rule::in($this->selfServiceStatuses($user))]; | ||
| $rules['delegation_user_id'] = [ |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: MEDIUM
Description: A user with only edit-personal-profile can PUT /api/1.0/users/{self} and store status OUT_OF_OFFICE plus delegation_user_id set to any other active, non-system user. Process-variable assignment then puts that delegate into the assignee pool with no check that they are on the task's user or group list. The resulting process_request_tokens.user_id is enough for ProcessRequestTokenPolicy to allow view and complete, and for ForUserScope to show the parent request.
Impact: The previous self-service denylist kept delegation_user_id with manager_id, so only an edit-users administrator could name a backup. This change lets an ordinary profile user redirect future process-variable work — including request data and task completion — to an account the process never assigned. That is a cross-user task and request-data boundary, not a personal display preference. Fixed user, group, and user_by_id assignment do not perform this substitution, and delegateTask only writes an assignee when an external assignment process exists.
Remediation: Do not accept an unconstrained delegation_user_id on the personal-profile allowlist. Keep the column admin-managed, or before saving it require a relationship that is allowed to receive this user's work (same task assignment list, shared group, or an explicit delegate grant). Apply that same check in getNextUserFromProcessVariable and getNextUserFromProcessVariableRaw before copying the id into process_request_tokens.user_id.
|
QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net |
|






Issue
Ticket: FOUR-33773
Users with only Edit Personal Profile could set their own status to Active or Inactive. Out of Office and the replacement user (Delegation) were available only on Admin → Users → Edit User, along with Blocked, Scheduled, and Manager.
Edit Profile now offers Out of Office and a replacement picker for the signed-in user. Blocked, Scheduled, and Manager stay on the admin user editor.
Solution
package-advanced-user-manager
delegation_user_idwhen the replacement user is deletedprocessmaker
delegation_user_idwith a personal-profile save, and send only the personal-profile fields for users who are not administrators and do not have Edit Usersdelegation_user_idon a self-service user updateWith no usable replacement (none set, deleted, or not Active), a new task follows the existing empty-Delegation path and goes to the Process Manager, and a reassigned task also goes to the Process Manager. A self-service task stays unassigned. If the process has no Process Manager, the existing "no Process Manager" error is returned, as before. Tasks already moved are not pulled back, and in-progress tasks are not moved when a user goes Out of Office.
How To Test
Automated Tests
phpunit vendor/processmaker/package-advanced-user-manager/tests/Feature/PersonalProfileOutOfOfficeTest.phpphpunit tests/Feature/Api/UsersTest.php --filter testSelfServiceUpdatephpunit tests/Feature/ProfileTest.php --filter testEditProfilePassesSignedInUserToSettingsAddonsphpunit tests/Model/UserTest.php --filter testOnlyAnActiveReplacementCanReceiveADelegatedTaskphpunit tests/Feature/Api/TaskAssignmentByVariableTest.php --filter testOutOfOfficeAssignmentUsesOnlyAnActiveReplacementphpunit tests/Feature/Api/TaskAssignmentTest.php --filter testUnavailableReplacementResolvesToProcessManagerManual Tests
ci:package-advanced-user-manager:task/FOUR-33773
ci:deploy
Code Review Checklist
redeploy: 10 Nov .