You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when we reprocess data from BC Registries we either:
reprocess the company from BC Reg and post and new/updated data
delete the company from OrgBook completely, and then reprocess (completely) from the source BC Reg database
The second method - delete and then reprocess - is sometimes necessary to make sure we don't wind up with "bad history" in OrgBook (i.e. something in the source data has changed and we want to replace the data in OrgBook, rather than just appending any new data).
This is a problem if there are credentials from other issuers - the current approach will aggressively delete these along with all other data attached to this company.
Instead, it should delete only credentials issued from BC Registries (Registration, BN and Relationship credentials), and then only if there are not more credentials it should delete the company's topic record.
This will create a short-term issue in OrgBook - a topic record for the company will exist, along with credential(s) from other issuer(s) - however this will be cleaned up once the company is re-processed from BC Registries and the credentials are re-issued.
The script currently executes the following steps:
Delete all credentials for the selected company from the wallet (by selecting all OrgBook credentials, and then deleting each credential from the wallet based on the credential_id)
Delete all "related company" credentials - these are credentials owned by other companies that point to the company we are deleting as a "related company"
Delete the topic from OrgBook - Django does a cascading delete that deletes all information on this topic.
Do update the process to do a "selected delete":
Need to configure the "BC Reg Issuer ID", and only delete credentials that are issued by this issuer. In the OrgBook database, the issuer info is in the issuer table, and BC registries can be identified with name='BC Corporate Registry'. The credentials (to delete) can then be filtered by the Credential.CredentialSet.CredentialType.Issuer attribute. At this point set a flag (non_bc_reg_creds) if there are any credentials for this company that are not issued by BC Registries.
Based on step 1 (non_bc_reg_creds) - if true (ie there are non-BC Reg credentials) then skip this step (since we will leave the company's topic record, any "related company" records will still have a company to point to.
Based on step 1 (non_bc_reg_creds) - if false (i.e. all credentials were issued by BC Reg) then proceed as normal. If true (ie there are non-BC Reg credentials) then a selective delete is required:
Select all credentialTypes for the BC Reg issuer, and then delete all hookable_cred records for each credentialType for the selected company
Select all CredentialSets (topic.credential_sets) and delete each credentialSet issued by the BC Reg issuer
Delete all name and address objects for the selected company (not sure if these will get cascade-deleted when the credentialSet gets deleted)
Select all TopicRelationship records owned by the selected company and delete them.
This should leave the company's topic record, along with the CredentialSets and Credentials (and related attributes) for non-BC Reg credentials.
At this point the data will be in an incomplete state, and if viewed through the OrgBook UI most data fields will be blank. The company should be re-processed from BC Reg as soon as possible.
(The effort shouldn't be more than a couple of days, including testing.)
The text was updated successfully, but these errors were encountered:
Currently when we reprocess data from BC Registries we either:
The second method - delete and then reprocess - is sometimes necessary to make sure we don't wind up with "bad history" in OrgBook (i.e. something in the source data has changed and we want to replace the data in OrgBook, rather than just appending any new data).
This is a problem if there are credentials from other issuers - the current approach will aggressively delete these along with all other data attached to this company.
Instead, it should delete only credentials issued from BC Registries (Registration, BN and Relationship credentials), and then only if there are not more credentials it should delete the company's topic record.
This will create a short-term issue in OrgBook - a topic record for the company will exist, along with credential(s) from other issuer(s) - however this will be cleaned up once the company is re-processed from BC Registries and the credentials are re-issued.
The script in question is here - https://github.com/bcgov/aries-vcr/tree/main/server/vcr-server/agent_webhooks/management/commands
The script currently executes the following steps:
credential_id
)Do update the process to do a "selected delete":
issuer
table, and BC registries can be identified withname='BC Corporate Registry'
. The credentials (to delete) can then be filtered by theCredential.CredentialSet.CredentialType.Issuer
attribute. At this point set a flag (non_bc_reg_creds
) if there are any credentials for this company that are not issued by BC Registries.non_bc_reg_creds
) - iftrue
(ie there are non-BC Reg credentials) then skip this step (since we will leave the company'stopic
record, any "related company" records will still have a company to point to.non_bc_reg_creds
) - iffalse
(i.e. all credentials were issued by BC Reg) then proceed as normal. Iftrue
(ie there are non-BC Reg credentials) then a selective delete is required:hookable_cred
records for each credentialType for the selected companytopic.credential_sets
) and delete each credentialSet issued by the BC Reg issuername
andaddress
objects for the selected company (not sure if these will get cascade-deleted when the credentialSet gets deleted)This should leave the company's
topic
record, along with the CredentialSets and Credentials (and related attributes) for non-BC Reg credentials.At this point the data will be in an incomplete state, and if viewed through the OrgBook UI most data fields will be blank. The company should be re-processed from BC Reg as soon as possible.
(The effort shouldn't be more than a couple of days, including testing.)
The text was updated successfully, but these errors were encountered: