Skip to content

FOUR-33773 | Add Out of Office Status and Delegation for Users With Edit Personal Profile Permission - #9098

Open
mcraeteisha wants to merge 7 commits into
developfrom
task/FOUR-33773
Open

mcraeteisha wants to merge 7 commits into
developfrom
task/FOUR-33773

Conversation

@mcraeteisha

@mcraeteisha mcraeteisha commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Add Out of Office to the Edit Profile status list
  • Add the Delegation picker to Edit Profile, using a profile lookup that returns id and full name for active users and excludes the current user
  • Clear delegation_user_id when the replacement user is deleted
  • Clear a stored replacement on save when that user is missing, soft-deleted, or a system user

processmaker

  • Load the profile settings add-on slots, passing the signed-in user, so the Delegation picker renders on Edit Profile
  • Send delegation_user_id with a personal-profile save, and send only the personal-profile fields for users who are not administrators and do not have Edit Users
  • Accept delegation_user_id on a self-service user update
  • Allow Active, Inactive, and Out of Office. Keep an administrator-assigned status, such as Scheduled, when the save does not change it
  • Before validation, clear a replacement the profile picker can no longer load so the rest of the save is not rejected
  • Give a task to an Out of Office user's replacement only when the replacement is Active and not deleted. This is checked when the task is assigned, so a replacement who later becomes Inactive, Out of Office, or Scheduled does not receive it. It applies to new tasks and to reassignment
  • When a reassignment finds nobody who can take the task, assign it to the Process Manager instead of saving it unassigned, and skip the reassignment notification when there is no assignee

With 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.php
  • phpunit tests/Feature/Api/UsersTest.php --filter testSelfServiceUpdate
  • phpunit tests/Feature/ProfileTest.php --filter testEditProfilePassesSignedInUserToSettingsAddons
  • phpunit tests/Model/UserTest.php --filter testOnlyAnActiveReplacementCanReceiveADelegatedTask
  • phpunit tests/Feature/Api/TaskAssignmentByVariableTest.php --filter testOutOfOfficeAssignmentUsesOnlyAnActiveReplacement
  • phpunit tests/Feature/Api/TaskAssignmentTest.php --filter testUnavailableReplacementResolvesToProcessManager

Manual Tests

  1. Sign in as a user whose only relevant permission is Edit Personal Profile.
  2. Open Edit Profile. Confirm the status list is Active, Inactive, and Out of Office.
  3. Confirm Delegation is shown and Manager, Blocked, and Scheduled are not.
  4. Set Out of Office, choose a replacement, and save. Refresh and confirm both values persisted.
  5. Set the status back to Active without changing Delegation. Confirm new tasks still come to that user, and the replacement remains saved.
  6. On Admin → Users → Edit User, confirm Active, Inactive, Blocked, Out of Office, Scheduled, Delegation, and Manager are still available.
  7. Set the user to Out of Office again. As an administrator, set the replacement to Inactive. Confirm new tasks for the Out of Office user go to the Process Manager, not the replacement.
  8. Delete the replacement user. Confirm Delegation is cleared on the other user.
  9. Set that user to Out of Office again without choosing a replacement. Confirm new tasks are not assigned to the deleted user.

ci:package-advanced-user-manager:task/FOUR-33773
ci:deploy

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..

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.
@cursor

cursor Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes core workflow task assignment and reassignment fallbacks; behavior shifts when delegates are inactive or missing, though covered by new tests.

Overview
Users with Edit Personal Profile can set Out of Office and a delegation (replacement) user from Edit Profile, with the API accepting delegation_user_id and restricting self-service status to Active, Inactive, and Out of Office (while still allowing save when the account already has an admin-only status like Scheduled). Stale or invalid replacements are cleared before validation so profile saves do not fail when the picker can no longer load the delegate.

Task assignment now substitutes an out-of-office assignee only when the linked replacement is ACTIVE and not deleted (activeDelegationUserId / acceptResolvedAssignee), including process-variable assignment and the assignment-process path. If reassignment resolves to nobody eligible, the task goes to the process manager instead of staying unassigned, and reassignment notifications are skipped when there is no assignee.

The profile UI loads settings add-ons with the signed-in user, sends a trimmed payload for self-service saves, and raw execution queries align with the same delegation and soft-delete rules.

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

@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.

Stale Bugbot comment from a previous run.

Comment thread ProcessMaker/Http/Controllers/ProfileController.php Outdated
@vladyrichter

Copy link
Copy Markdown

QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net

@vladyrichter

Copy link
Copy Markdown

QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net

@eiresendez eiresendez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved! I'm just adding a possible edge case but not a blocker, if replacements are required to remain assignable.

Comment thread ProcessMaker/Http/Controllers/Api/UserController.php
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.

@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.

Stale Bugbot comment from a previous run.

Comment thread ProcessMaker/Models/ProcessRequestToken.php Outdated
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.

@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 high 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.

Reviewed by Cursor Bugbot for commit dc43686. Configure here.

Comment thread ProcessMaker/Http/Controllers/Api/UserController.php
Comment thread ProcessMaker/Models/Process.php Outdated
@vladyrichter

Copy link
Copy Markdown

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.
@nolanpro

Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net

@decisions-sonarqube

Copy link
Copy Markdown

@nolanpro

Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://tenant-1.ci-8cc146d8fa.engk8s.processmaker.net

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.

4 participants