Skip to content

Add support for user group or multiple users in pipeline approvals#71

Open
petero-dk wants to merge 1 commit into
PurpleSoftSrl:mainfrom
zealofzebras:bugfix/approvercheck
Open

Add support for user group or multiple users in pipeline approvals#71
petero-dk wants to merge 1 commit into
PurpleSoftSrl:mainfrom
zealofzebras:bugfix/approvercheck

Conversation

@petero-dk

Copy link
Copy Markdown

This pull request enhances the logic for determining whether the current user can approve pipeline approvals, especially when approvals may be assigned to user groups in addition to individuals. The main changes introduce a mechanism to resolve and cache all graph descriptors (user and group) that identify the current user as an approver, and update the approval logic to use this information for more accurate permission checks.

Improvements to approval logic:

  • Added a private _approverDescriptors set and logic in _PipelineDetailController to store all descriptors (user and groups) that identify the current user as an approver. This set is fetched when approvals are present. [1] [2]
  • Refactored the _canApprove and _isBlockedApprover methods to use a new _isCurrentUser helper, which checks if an AssignedApprover matches the current user by email, id, or descriptor (including group membership). This ensures that group-based approvals are correctly recognized.

API service enhancements:

  • Added a new getCurrentUserApproverDescriptors method to the AzureApiService interface, and implemented it in AzureApiServiceImpl. This method computes (and caches) all graph descriptors for the current user, including transitive group memberships, by traversing the membership graph. [1] [2] [3]
  • Ensured the cached descriptors are cleared on logout to prevent stale data.
  • Updated the mock API service to implement the new method for testing.

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.

1 participant