How to Purge an Organization on CKAN GUI - ckan/ckan GitHub Wiki

The Sequence Diagram for performing the purge operation along with steps as to how can we perform this operation.

There are two Steps in Purging of organization as Follows:

First Step: To display the deleted organization in trash section on CKAN GUI.

Second Step: After first step gets completed, we can now perform purge operation on Organization whose State=”Deleted”

Note: Purging of organization cannot be undone. It purges all organization in one go.

Explanation:

  1. To perform purge operation on Organization in CKAN GUI, we need to have admin authorization. for more info refer : Authorizations on Organisation
  2. After Logging in as an admin user, switch to http://<my-ckan-url>/ckan-admin and click on Trash section.
  3. When we click on Trash section, we see a Purge Button for purging of Datasets only. Thus, for performing Purge operation on GUI, we can create a purge organization button as

shown

  1. For adding Purge Organization button in GUI, we need to edit trash.html present in /templates/admin. There we have to set the name attribute as purge-org(any name of your wish, we will use it in admin.py)in for this button.

  2. Now, create a sample organization for e.g. ABC and delete it. We should be able to see the deleted organization in the trash section as

shown

  1. Now, as our first step is completed. We can now proceed to Second step. The file to be changed/edited is /ckan/controllers/admin.py.

  2. In function trash() for file /ckan/controllers/admin.py, we need a variable to store the organization whose state is deleted.

  3. Now, we need to use the value assigned in name attribute in Step 4 here to redirect for performing purge operation on organization.

  4. Before purging of organization, we need to check that there is no dataset in the organization to avoid validation error.

  5. Now, we can purge the organization by removing all its associated revisions.

  6. If all the above steps are performed correctly, “Purge Completed”(or any message of your choice) will be flashed on CKAN GUI as shown below

below.