Implement ECS tenant soft deletion functionality
Description
Environment
Potential Workaround
Attachments
clones
has to be done before
is cloned by
Checklist
hideTestRail: Results
Activity

Serhii_NoskoJanuary 4, 2024 at 2:54 PM
Karate test for ECS tenant soft deleting functionality was implemented in scope of this PR: https://github.com/folio-org/folio-integration-tests/pull/1163 , closing the story

Serhii_NoskoJanuary 4, 2024 at 2:00 PMEdited
Tested on https://folio-dev-thunderjet-consortium.ci.folio.org/ , works as expected.
Here is detailed testing flow.
Initialy we have 3 tenants in the consortium
2. We have CollegeUser in college tenant
3. We have CollegeInstance in college tenant
4. We make soft deleting of college tenant
5. Check that we have only 2 tenants visible after soft deleting of college tenant
6. Check Get Tenant by Id endpoint to make sure that isDeleted flag for college tenant set to true
7. Check that college tenant is not visible in Switch affiliation modal any more
8. Check that request to retrieve user is forbidden to soft deleted college tenant. Baisically each http request is forbidden to college tenant now. For testing we restarted mod-authtoken with param 'user.cache.purge.seconds'=10 (by default user-tenants cach is invalidated each 24 hours).
9. Check also that we could not retrieve instance from college tenant
10. Re-add soft deleted college tenant again with the same name and code
11. College affiliation is appears now and we can successfully switch to this affiliation
12. Now we can see user in college tenant again (all http requests to college tenant become valid again)
13. Also we can see CollegeInstance in college tenant and any other entity
14. User tenant affilaitons that stored in central tenant looks as before (because there wasn't any physical deteing from mod-consortia tables during tenant soft-deleting process)
Details
Assignee
Azizbek KhushvakovAzizbek KhushvakovReporter
Serhii_NoskoSerhii_NoskoPriority
P3Story Points
3Sprint
NoneDevelopment Team
ThunderjetFix versions
Release
Quesnelia (R1 2024)TestRail: Cases
Open TestRail: CasesTestRail: Runs
Open TestRail: Runs
Details
Details
Assignee

Reporter

Purpose:
Need to implement the possibility to soft delete the ECS tenant.
This will be using for hiding tenant or for tenant re-create flow as descibed below
Recreating general flow:
Make DB dump of the desired tenant
Make http request to delete tenant from Okapi
Make http request to soft delete tenant from consortium
Make http request to create ECS tenant with the same tenant id
Soft Delete ECS tenant requirements:
The flow started when tenant was deleted from okapi and DB dump of this tenant already applied or for temporary hiding tenant from consortium
If desired deletion tenant is central tenant - throw an error, that this operation is forbidden
Mark desired tenant as soft deleted in tenant table(use new is_deleted flag in tenant table)
Call DELETE /user-tenant record in mod-users to forbid requests to this tenant
UserTenantService should be modified to filter out user tenant associations where the tenant is_deleted flag set to true. This needed to not see affiliations in the header.
Get tenants endpoint should be modified to filter out soft deleted tenants.
Note: Sharing instances, sharing settings stored in central tenant, so they will not be corrupted by member tenant re-creating(just need to make sure that DB dump of the desired tenant was applied to restore original settings, instances, users etc)