0

I have some GeoNode instances (versions 2.4 & 2.6) running on Ubuntu virtual machines and am trying to restrict a layer to only registered users. According to the docs one should be able to edit permissions of a layer on the GeoNode GUI:

You can now choose whether you want your layer to be viewed and downloaded by

  • anyone
  • any registered user
  • a certain user (or group)

But when I go to my.geonode/layers/my_layer -> "Change Layer Permissions" (logged in as admin = superuser), all I see is this: enter image description here

The problem is: I don't want to set permissions on specific users or groups but want to let ALL registered users (there are a lot, so I want to avoid adding each single user or creating a group containing all users) view this layer, i.e. deny access to anonymous users. How can I achieve this?

  • As far as i know, current stable 2.6.3 version does not have the option "any registered user", and even the docs you linked state so. There´s another option of restricting certain URLs to only registered users through local_settings (set LOCKDOWN_GEONODE=True and add public URLs to AUTH_EXEMPT_URLS), but that will make all your layers unseen by non registered users. – geoA Oct 19 '17 at 18:11
  • Too sad this is not yet implemented. I tried to set permissions programmatically with layer.set_permissions({'users': {'AnonymousUser': []}}, as suggested here: github.com/GeoNode/geonode/blob/master/geonode/tests/… but this won't work either. So the only way to achieve this is to add each user on its own or to create a group that contains all users...? – Franka Oct 24 '17 at 8:02
1

Couldn't find a way to do it in geonode, but If you want you can give permission to download data to any registered user by changing html files.

If user not logged in to the system, to hide Download Layer button in layer view page, just add this if statement {% if user.is_authenticated %} in layer_detail.html before <li> tag.

sudo nano /usr/local/lib/python2.7/dist-packages/geonode/layers/templates/layers/layer_detail.html

and go to line no 141 and add {% if user.is_authenticated %}

before <li class="list-group-item"> and then close if statement {% endif %} in line no 149 after the </li>

after changed the layer_detail.html file,

line no 139 to 153

<ul class="list-group">
  {% if resource.storeType != "remoteStore" %}
    {% if user.is_authenticated %}
    <li class="list-group-item">
    {% if links %}
       <button class="btn btn-primary btn-md btn-block" data-toggle="modal" data-target="#download-layer">{% trans "Download Layer" %}</button>
    {% else %}
      {% if request.user.is_authenticated %}
      <button class="btn btn-primary btn-md btn-block" id="request-download">{% trans "Request Download" %}</button>
      {% endif %}
    {% endif %}
    </li>
    {% endif %}
  {% endif %}
</ul>

then restart apache server

sudo service apache2 restart

now if user not logged in user can't see the download layer button.

if you want, you can do this to map details page also (map details page path : /usr/local/lib/python2.7/dist-packages/geonode/maps/templates/maps/map_detail.html)

  • I belive Franka wants a (single or fiew) layer(s) to be seen or downloaded only by registered users. This procedure will keep unregistered users from downloading ANY layer in GeoNode. – AN For Jan 21 '18 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.