Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ADD operation replacing permissions of the role #588

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

ThaminduR
Copy link
Contributor

@ThaminduR ThaminduR commented Dec 17, 2024

Problem

When performing an ADD operation on a role's permissions via the SCIM2 API, the existing permissions are incorrectly replaced instead of appending the new permissions.

Root Cause

The issue was caused by the prepareReplacedPermissionLists method being executed for every patch operation. This method clears the existing permissions, which is appropriate for the REPLACE operation but not for ADD or REMOVE.

Solution

  • The fix ensures that prepareReplacedPermissionLists is only executed for the REPLACE operation, preventing unintended clearing of permissions during ADD or REMOVE operations.

  • Added unit tests scenarios to cover the permission update operations

Issue

wso2/product-is#21628

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.66%. Comparing base (c457f30) to head (0a694ab).
Report is 13 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #588      +/-   ##
============================================
+ Coverage     44.45%   44.66%   +0.20%     
+ Complexity     1035      965      -70     
============================================
  Files            41       41              
  Lines          8943     9008      +65     
  Branches       1925     1929       +4     
============================================
+ Hits           3976     4023      +47     
- Misses         4092     4100       +8     
- Partials        875      885      +10     
Flag Coverage Δ
unit 29.29% <100.00%> (+0.69%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/12370443033

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/12370443033
Status: success

Copy link

@jenkins-is-staging jenkins-is-staging left a comment

Choose a reason for hiding this comment

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

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/12370443033

@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/12647405104

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/12647405104
Status: failure

@ThaminduR ThaminduR merged commit 1da4ffb into wso2-extensions:master Jan 16, 2025
5 checks passed
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