[ckan-dev] Extension for keeping package public but not resources

Matthew Fullerton matt.fullerton at gmail.com
Thu Sep 22 08:11:36 UTC 2016


Hi Lucia,
If you want to just hide the listing of resources when you don't have a
logged in user you can do something like this in an extension:

Override template: package/snippets/resources_list.html

{% ckan_extends %}
{% if not c.userobj %}
  {% block resource_list %}
  {% endblock %}
{% endif %}

This should have the effect of overriding the resource list with emptiness
only when no user is logged in. I haven't tested it though. And it is (as
you seem to be OK with) not secure and merely superficial.

Best,
Matt

--
Matt Fullerton
Software development and data science for open data and mobility
matt at crowdsalad.de
+49 89 7456 0495 / +49 176 5789 6501
http://www.crowdsalad.de

On 21 September 2016 at 10:25, <lucia.espona at wsl.ch> wrote:

> Dear all
>
> For my current CKAN instance, I would like the package metadata
> (description, etc) to be always public, but I would need to restrict the
> access to the resources (data, files). As a start, it will be enough if the
> resource data is just accessible to registered users. It doesn't need to be
> something super secure, I may be enough to just "hide" them.
>
> Does anyone know about extension or developments done in this direction?
>
> Thanks a lot,
> Lucia
>
>
> _________________________________________________________
> Dr. Lucia Espona Pernas
>
> Swiss Federal Institute for Forest, Snow and Landscape Research WSL
> Hauptgebäaude Labortrakt (HL C21)
> Zürcherstrasse 111
> 8903 Birmensdorf
> Switzerland
>
> +41 44 739 28 71 phone direct
> +41 44 739 21 11 reception
>
> www.wsl.ch
> _______________________________________________
> 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/20160922/4ca560cf/attachment-0003.html>


More information about the ckan-dev mailing list