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

Clear sharing policy store based on related resource deletion #433

Merged

Conversation

AnuradhaSK
Copy link
Contributor

@AnuradhaSK AnuradhaSK commented Jan 25, 2025

Purpose

Resource sharing policies and the attached attributes for them will be stored in a generic data model.

Screenshot 2025-01-25 at 15 47 17

Hence Resource types and Attributes types related data stored in above database table don't have foreignkey references.

For eg: If a user is deleted, the user sharing policies stored in the above tables need to be cleared through post event hadler / event listener of user delete action.
Similarly, we have to handle any supported resource type or attribute type.

Currently used resources are Users. Attaching to user sharing policies roles are used as attributes.
So, adding an event handler subscribed to POST_DELETE_ROLE_V2_EVENT and POST_USER_DELETE events.

On organization deletion, clearing the resource policies will be handled due to foreign key restrictions.

Fix: wso2/product-is#22434

Related PRs

Depends on #422

Copy link

codecov bot commented Jan 25, 2025

Codecov Report

Attention: Patch coverage is 64.51613% with 11 lines in your changes missing coverage. Please review.

Project coverage is 49.21%. Comparing base (930b0f6) to head (1b6bc50).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...OrganizationManagementHandlerServiceComponent.java 0.00% 6 Missing ⚠️
...anagement/handler/SharingPolicyCleanUpHandler.java 77.27% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #433      +/-   ##
============================================
+ Coverage     49.15%   49.21%   +0.06%     
- Complexity     1250     1258       +8     
============================================
  Files           142      143       +1     
  Lines          7873     7904      +31     
  Branches        972      973       +1     
============================================
+ Hits           3870     3890      +20     
- Misses         3679     3689      +10     
- Partials        324      325       +1     
Flag Coverage Δ
unit 37.73% <64.51%> (+0.15%) ⬆️

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.

@AnuradhaSK AnuradhaSK force-pushed the clear-sharing-policy-store branch from 5c431ce to 1b6bc50 Compare January 25, 2025 14:01
@jenkins-is-staging
Copy link

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

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/12965704278
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/12965704278

@AnuradhaSK AnuradhaSK merged commit 41d2019 into wso2-extensions:main Jan 25, 2025
4 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.

Introduce a user sharing policy cleanup handler on user and role deletion
3 participants