[ckan-dev] List all Private Datasets

Pedro G Silva pedro.gracio at deimos.com.pt
Wed Jun 29 12:25:56 UTC 2016


Hi
I was able, has tyler suggested, to implement what I wanted. I implented a
new api endpoint /api/action/package_search_dme, where I changed the
 context["*ignore_capacity_check"] *and then make a*  _check_access *on the
results and modify it based on the user having permissions or not to list
the datasets. It is not perfect and I had to add my code to the ckan core
code but it works. If anyone is interested let me know.

Thanks for the help

On Tue, Jun 28, 2016 at 3:53 PM, Alex Gartner <
alexandru.gartner+ckan at gmail.com> wrote:

> Just to add to what was already said: organization_show() will also show
> private datasets in case you have the right to see them.
> Otherwise, i guess easiest is to use package_search() with context["
> *ignore_capacity_check"]* from your own extension / code as Tyler
> mentioned.
>
> On Tue, Jun 28, 2016 at 5:47 PM, Pedro G Silva <pedro.gracio at deimos.com.pt
> > wrote:
>
>> Matt, I'm trying to list for a specific user, I  tried with the admin key
>> but I  it didn't work.
>>
>> Tyler, using capacity did not work. I'll try your other suggestion, thank
>> you!
>>
>> On Tue, Jun 28, 2016 at 3:45 PM, Tyler Kennedy <tk at tkte.ch> wrote:
>>
>>> Actually, that won't work either since we're explicitly forcing
>>> *package_search* to only return public datasets:
>>> https://github.com/ckan/ckan/blob/7a58753aefe8b8edebf4ebb429e65e2b9a5cd1bd/ckan/logic/action/get.py#L1830
>>>
>>> You can get around this by adding your own controller that sets
>>> *ignore_capacity_check* to *True* or you can (as a temporary
>>> workaround) call *current_package_list_with_resources* using an admin
>>> API key to get all packages including those that are private since it does
>>> its own check -
>>> https://github.com/ckan/ckan/blob/7a58753aefe8b8edebf4ebb429e65e2b9a5cd1bd/ckan/logic/action/get.py#L184
>>>
>>> On Tue, Jun 28, 2016 at 10:32 AM, Tyler Kennedy <tk at tkte.ch> wrote:
>>>
>>>> Hey,
>>>>
>>>> *capacity:private* or *capacity:public. *
>>>>
>>>> Thank you,
>>>> Tyler Kennedy
>>>>
>>>> On Tue, Jun 28, 2016 at 10:28 AM, Pedro G Silva <
>>>> pedro.gracio at deimos.com.pt> wrote:
>>>>
>>>>> Hi
>>>>> /api/action/package_search?q=private:false
>>>>>
>>>>> works, but using true instead of false shows no results, even if I'm
>>>>> using the auth key of the dataset owner.
>>>>>
>>>>> Is this a bug?
>>>>>
>>>>> On Tue, Jun 28, 2016 at 3:11 PM, Pedro G Silva <
>>>>> pedro.gracio at deimos.com.pt> wrote:
>>>>>
>>>>>> Hi
>>>>>> Is there a way to list all private datasets using the API? Or
>>>>>> searching?
>>>>>>
>>>>>> --
>>>>>>
>>>>>>
>>>>>> [image: DEIMOS Engenharia, SA] <http://www.deimos.pt>
>>>>>> *Pedro Gracio Silva*
>>>>>> Aerospace Systems / Production Center
>>>>>>
>>>>>> *Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal*
>>>>>> Ph: +351 21 893 3020 • Fax: +351 21 896 9099
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>> [image: DEIMOS Engenharia, SA] <http://www.deimos.pt>
>>>>> *Pedro Gracio Silva*
>>>>> Aerospace Systems / Production Center
>>>>>
>>>>> *Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal*
>>>>> Ph: +351 21 893 3020 • Fax: +351 21 896 9099
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>>
>>
>> [image: DEIMOS Engenharia, SA] <http://www.deimos.pt>
>> *Pedro Gracio Silva*
>> Aerospace Systems / Production Center
>>
>> *Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal*
>> Ph: +351 21 893 3020 • Fax: +351 21 896 9099
>>
>>
>> _______________________________________________
>> 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
>>
>>
>


-- 


[image: DEIMOS Engenharia, SA] <http://www.deimos.pt>
*Pedro Gracio Silva*
Aerospace Systems / Production Center

*Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal*
Ph: +351 21 893 3020 • Fax: +351 21 896 9099
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160629/1b13c00d/attachment-0003.html>


More information about the ckan-dev mailing list