[ckan-dev] Deleting/purging an organisation CKAN 2.1

David Megginson david.megginson at megginson.com
Tue Jun 3 11:25:36 UTC 2014


I think you have to change the group_revision table as well, and then
possibly trigger a Solr reindex.  Since an organisation is just a special
case of a group in the internal CKAN data model, this might help:

http://stackoverflow.com/questions/18141185/ckan-how-to-restore-a-previously-deleted-group


Cheers, David


On Mon, Jun 2, 2014 at 8:14 PM, Jason Tan <jason.tan at ersa.edu.au> wrote:

> Hi David,
>
> I've be happy to turn the "deleted" group back on, but I'm not sure what I
> need to do.
>
> I've changed it's "state" column value in the database from "deleted" to
> "active" and that has not re-activated the group.
> The other problem is that we actually want the name to be used for an
> organisation now, not a group.
> I would assume you can do this by setting the is_organization and type
> columns appropriately, but I'm not sure if any other changes would need to
> be made to the DB.
>
> Because of all that I thought actually deleting might be easier, but if
> someone knows the 2.1.1 schema well enough to allow me to turn the group on
> and change the group to an organization, I'd be happy to do that.
>
> Regards
> Jason Tan
>
>
> On 3 June 2014 04:17, David Megginson <david.megginson at megginson.com>
> wrote:
>
>> CKAN doesn't like to hard-delete things. Would it make more sense to
>> remove all users and datasets from the organisation manually, then just
>> reassign it to new users and datasets?
>>
>>
>> Cheers, David
>>
>>
>> On Mon, Jun 2, 2014 at 4:17 AM, Jason Tan <jason.tan at ersa.edu.au> wrote:
>>
>>> Hi All,
>>>
>>> I'm trying to remove a deleted CKAN organisation/group from CKAN 2.1.1.
>>> The reason we want to do this is because we have decided that we want to
>>> use the same name/URL again, so advice on how to "turn it on" again would
>>> be just as useful for now.
>>>
>>> I gather from these emails in a thread from Feb that I should be doing
>>> an organization_purge
>>> https://lists.okfn.org/pipermail/ckan-dev/2014-February/006906.html
>>> https://lists.okfn.org/pipermail/ckan-dev/2014-February/006908.html
>>>
>>> But I can't seem to get organization purge to work with 2.1.1 (see
>>> output below).
>>>
>>> So my questions are:
>>> 1) Is the organization_purge implemented in 2.1.1?
>>> 2) If it is not how do I remove an organization completely?
>>> 3) Can I turn the organization back on - is it simply a matter of
>>> changing  the state column of the group table from "deleted" to "active" or
>>> is there more to it than this?
>>>
>>> Thanks and Regards
>>> Jason Tan
>>>
>>>
>>>
>>>
>>> organization_delete apparently works fine - I assume that is what is
>>> eventually invoked when you click the delete button on the Organization
>>> page as despite the fact we get a "success" message it does not actually
>>> get rid of the organization /group i.e. we can go to
>>> https://ckan-app-dev.green.ersa.edu.au/organization/some-university or
>>> https://ckan-app-dev.green.ersa.edu.au/group/some-university and see
>>> the details
>>> curl --user ersackan:ersa-rdsi-ckan  -k
>>> https://ckan-app-dev.green.ersa.edu.au/api/3/action/organization_delete
>>> -H "X-CKAN-API-KEY: <my api key>"  -d '{"id":"some-university"}'
>>> {"help": "Delete a organization.\n\n    You must be authorized to delete
>>> the organization.\n\n    :param id: the name or id of the organization\n
>>>  :type id: string\n\n    ", "success": true, "result": null}
>>> I guess demonstrates that the general from of my curl command is correct
>>> (curl's -k flag just says ignore cert problems).
>>>
>>>
>>> However organization_purge does not work from curl
>>> curl --user ersackan:ersa-rdsi-ckan  -k
>>> https://ckan-app-dev.green.ersa.edu.au/api/3/action/organization_purge
>>> -H "X-CKAN-API-KEY: <my api key>"  -d
>>> '{"id":"91a1ae30-2928-4722-89a7-0395fedb3010"}'
>>> "Bad request - Action name not known:
>>> organization_purge"[root at ckan-db-dev ~]#
>>>
>>>
>>> Or from the CLI:
>>> (default)[ckan at ckan-app-dev bin]$ echo '{"id":"flinders-university"}'|
>>>  /usr/lib/ckan/default/bin/paster --plugin=ckan post -c
>>>  /etc/ckan/default/development.ini /api/action/organization_purge
>>> No handlers could be found for logger "ckan.controllers.api"
>>>
>>> I
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Jason Tan
>>> Data Infrastructure Specialist, eResearch SA
>>>
>>> phone: +61 8 8313 2184
>>> Mob: +61 407 268 270
>>> email: jason.tan at ersa.edu.au
>>> web: http://www.ersa.edu.au
>>>
>>> _______________________________________________
>>> ckan-dev mailing list
>>> ckan-dev at lists.okfn.org
>>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>>
>>>
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
>>
>
>
> --
> Jason Tan
> Data Infrastructure Specialist, eResearch SA
>
> phone: +61 8 8313 2184
> Mob: +61 407 268 270
> email: jason.tan at ersa.edu.au
> web: http://www.ersa.edu.au
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140603/4f7c882d/attachment-0003.html>


More information about the ckan-dev mailing list