bcgov / traction

Traction is designed with an API-first architecture layered on top of Hyperledger Aries Cloud Agent Python (ACA-Py) and streamlines the process of sending and receiving digital credentials for governments and organizations.
https://digital.gov.bc.ca/digital-trust/tools/traction/
Apache License 2.0
52 stars 48 forks source link

Support fully delete/drop tenant and associated wallet #1294

Closed Gavinok closed 1 month ago

Gavinok commented 1 month ago

This PR resolves #1253

I have added acapy endpoints for hard deleting tenants for both the innkeeper to delete any tenant and the tenant to delete themselves. I have also exposed this function in the UI

For the innkeeper it's simply a check box 2024-07-31_15-49-23

For the tenant a new button has been added to the profile page which will then prompt the user for confirmation.

2024-07-31_15-51-13

2024-07-31_15-51-44

github-actions[bot] commented 1 month ago
Deployment Resource Location
Traction
Tenant UI https://pr-1294-traction-tenant-ui-dev.apps.silver.devops.gov.bc.ca
Innkeeper UI https://pr-1294-traction-tenant-ui-dev.apps.silver.devops.gov.bc.ca/innkeeper
Aca-Py
Admin Swagger https://pr-1294-traction-acapy-admin-dev.apps.silver.devops.gov.bc.ca/api/doc
Tenant Proxy Swagger https://pr-1294-traction-tenant-proxy-dev.apps.silver.devops.gov.bc.ca/api/doc

Deployment URLs ready for review.

loneil commented 1 month ago

We're having the "you must type your name" super-confirm on just soft deleting a tenant as the Innkeeper, so I think we should for sure have more than just the standard confirm Yes/No on the Tenant Profile page for a full wallet removal.

There was discussion in the past about having the soft-delete flag be done first and then after a certain amount of time enabling a permanent delete. But if we're exposing the endpoint to permanent delete then of course the tenant can call it themselves. (I guess that endpoint could check the soft-delete flag was set at the least)

loneil commented 1 month ago

Chatted with @esune we can do this:

  1. On the Innkeeper side minor tweak to the UI to have radio buttons as "Suspend Tenant" and "Permanently Delete". If they click permanent delete display a warning message with an icon in bold yellow saying what it will do above the button.
  2. On the Tenant Profile page, use the same Confirmation box with those 2 radio buttons. So a Tenant has to manually type in their tenant name and has to pick which deletion type
  3. Allow the Tenant in the above box to soft-delete (the Suspend option). Think this should be possible for the tenant, it's just setting a flag in their tenant record. Will likely need to add a version of the DELETE /innkeeper/tenants/{id} endpoint that the Tenant can call, or first can check if setting the delete flag can be done with PUT /tenant/wallet can be used for this?

The soft delete is really just setting a flag at this time so we are adding a couple tickets for enhancement to that behaviour that can be picked up after this is done (can proceed with the above changes just using the existing soft delete behaviour)

Gavinok commented 1 month ago

Updated the ui and added support for soft deleting tenants

Here is the warning shown when permanently delete is selected

2024-08-01_16-22-54

This same prompt is now also used for tenants as well

Gavinok commented 1 month ago

I had thought about making it red as well but figured all the warnings would deter people from accidentally clicking it. I will change it now

loneil commented 1 month ago

Yes let's fix the width of this button for sure

image

Gavinok commented 1 month ago

2024-08-02_11-10-56 Updated tenant deletion button

loneil commented 1 month ago

Not exactly related to this PR but just confirming data deletion after tenant hard delted

image

Note this is for the current Traction mode of all wallets in the single database, going to check locally running in multi-DB mode.