[GeoNode-users] is_staff

Toni Schönbuchner toni.schoenbuchner at csgis.de
Thu Nov 16 12:16:48 PST 2017


Dear Aral,

to override a template file you shouldn´t change it in your installation but create a geonode project
for it. See documentation for more : http://docs.geonode.org/en/master/tutorials/admin/customize_lookfeel/customize/theme_admin.html <http://docs.geonode.org/en/master/tutorials/admin/customize_lookfeel/customize/theme_admin.html>
It might read complex but it´s really easy.

I think on Ubuntu apt installes geonode in /usr/local/lib/pythin2.7/dist-packages/geonode
you can use find to locate it:

find / -name geonode -type d 2>/dev/null

If you run in problems with the template project don´t hesistate to ask.

Cheers,

Toni

-----------------------------------------------
CSGIS

-----------------------------------------------
Kolonnadenstraße 1
04109 Leipzig
-----------------------------------------------
Mobil	+49/ (0) 176 6680 3198
Tel 		+49/ (0) 341 24 04 738
Fax 		+49/ (0) 341 24 04 73
Web		http://csgis.de
-----------------------------------------------

Hinweis gemäß § 33 BDSG
Daten der Verfahrensbeteiligten werden gespeichert. Dieses Dokument ist ausschließlich für den
Adressaten bestimmt. Der Inhalt der E-Mail ist vertraulich. Falls Sie diese E-Mail versehentlich
erhalten haben, rufen Sie uns unter obiger Rufnummer umgehend an und löschen Sie diese Nachricht
von Ihrem Computer. Jegliche Art von Reproduktionen, Verbreitung, Vervielfältigung, Veränderung,
Verteilung und/oder Veröffentlichung dieser E-Mail ist verboten.

> Am 16.11.2017 um 18:20 schrieb Kaymaz Aral Can CHST <aral_can.kaymaz at syngenta.com>:
> 
> 
> 
> Hello Paolo and Toni, <>
> 
> Thanks for your answers!
> 
> Currently, I have GeoNode + GeoServer installed on an Ubuntu 14.04 VM, using apt-get and the repos.
> 
> I assume, for your method to work, I would need to deploy the Dev version? Or can I just change a file in my current installed version, and it would simply work?
> 
> I’ve seen that you refer to geonode/layers/templates/layers/layer_list.html#L12 – if I changed this file in my installation (where would the file be? I’ve looked in /var/www/geonode, but seems to be not there), it would work – did I understand that correctly? If that is the case, I can simply include such change in my Ansible playbook, and have it installed automatically.
> 
> Thank you very much.
> 
> Kind regards,
> Aral Can Kaymaz
> R&D IS Solution Architect - Syngenta
> Phone: internal 60041 | external +41 (0) 62 866 00 41
> 
> From: Paolo Corti [mailto:pcorti at gmail.com]
> Sent: Donnerstag, 16. November 2017 16:40
> To: Toni Schönbuchner <toni.schoenbuchner at csgis.de>
> Cc: Kaymaz Aral Can CHST <aral_can.kaymaz at syngenta.com>; geonode-users <geonode-users at lists.osgeo.org>
> Subject: Re: [GeoNode-users] is_staff
> 
> Yes, that is exactly the solution I was thinking to.
> It would be nice - and not complicated - to have that method in GeoNode People model.
> p
> 
> On Thu, Nov 16, 2017 at 10:36 AM, Toni Schönbuchner <toni.schoenbuchner at csgis.de <mailto:toni.schoenbuchner at csgis.de>> wrote:
> True Paolo,
> thanks for your comments!
> 
> In the case all what Aral needs is to hide the button (unsure about this)
> it should also work to creat some new group other then stuff and check it in template, right?
> 
> Something like this:
> > See: hhttps://stackoverflow.com/a/46360225
> 
> from django import template
> from django.contrib.auth.models import Group
> 
> register = template.Library()
> 
> @register.filter(name='has_group')
> def has_group(user, group_name):
>     try:
>         group =  Group.objects.get(name=group_name)
>     except Group.DoesNotExist:
>         return False
> 
>     return group in user.groups.all()
> 
> Cheers,
> 
> Toni
> 
> -----------------------------------------------
> CSGIS
> 
> -----------------------------------------------
> Kolonnadenstraße 1
> 04109 Leipzig
> -----------------------------------------------
> Mobil +49/ (0) 176 6680 3198 <tel:+49%20176%2066803198>
> Tel  +49/ (0) 341 24 04 738 <tel:+49%20341%202404738>
> Fax  +49/ (0) 341 24 04 73 <tel:+49%20341%20240473>
> Web http://csgis.de <http://csgis.de/>
> -----------------------------------------------
> 
> Hinweis gemäß § 33 BDSG
> Daten der Verfahrensbeteiligten werden gespeichert. Dieses Dokument ist ausschließlich für den
> Adressaten bestimmt. Der Inhalt der E-Mail ist vertraulich. Falls Sie diese E-Mail versehentlich
> erhalten haben, rufen Sie uns unter obiger Rufnummer umgehend an und löschen Sie diese Nachricht
> von Ihrem Computer. Jegliche Art von Reproduktionen, Verbreitung, Vervielfältigung, Veränderung,
> Verteilung und/oder Veröffentlichung dieser E-Mail ist verboten.
> 
> Am 16.11.2017 um 16:24 schrieb Paolo Corti <pcorti at gmail.com <mailto:pcorti at gmail.com>>:
> 
> That is a solution, but it would require users to be assigned to the staff group, which means they will be able to use the Django Admin.
> p
> 
> 2017-11-16 10:15 GMT-05:00 Toni Schönbuchner <toni.schoenbuchner at csgis.de <mailto:toni.schoenbuchner at csgis.de>>:
> Hi Aral,
> 
> 
> 1.       All registered users seem to be able to upload a new layer. I would like to limit this, either to a specific group that I may define, or to only staff.
> Is this possible? I could not find any relevant setting, or any relevant documentation on this.
> 
> 
> If it´s enough for you to just hide the layer upload button for everybody not stufff you could do something like this:
> 
> change:
> 
> https://github.com/GeoNode/geonode/blob/ae9902c5b8561099bbc766b20720307d9766de21/geonode/layers/templates/layers/layer_list.html#L12 <https://github.com/GeoNode/geonode/blob/ae9902c5b8561099bbc766b20720307d9766de21/geonode/layers/templates/layers/layer_list.html#L12>
> 
> <a
> href="{%
>  url "layer_upload"
>  %}"
> class="btn
>  btn-primary pull-right">{%
>  trans "Upload Layers" %}</a>
> 
> 
> 
> to
> 
> 
> {% if
> user.is <http://user.is/>_staff %} <a
> href="{%
>  url "layer_upload"
>  %}"
> class="btn
>  btn-primary pull-right">{%
>  trans "Upload Layers" %}</a>
>  {% endif %}
> 
> 
> Keep in mind that it might still work that users use the geonode rest api.
> http://docs.geonode.org/en/master/tutorials/devel/geonode_apis/importer/rest_reference.html <http://docs.geonode.org/en/master/tutorials/devel/geonode_apis/importer/rest_reference.html>
> 
> Regading 2, unfortuantely I cannot help you with ActiveDirectory
> 
> cheers,
> 
> toni
> 
> -----------------------------------------------
> CSGIS
> 
> -----------------------------------------------
> Kolonnadenstraße 1
> 04109 Leipzig
> -----------------------------------------------
> Mobil +49/ (0) 176 6680 3198 <tel:+49%20176%2066803198>
> Tel  +49/ (0) 341 24 04 738 <tel:+49%20341%202404738>
> Fax  +49/ (0) 341 24 04 73 <tel:+49%20341%20240473>
> Web http://csgis.de <http://csgis.de/>
> -----------------------------------------------
> 
> Hinweis gemäß § 33 BDSG
> Daten der Verfahrensbeteiligten werden gespeichert. Dieses Dokument ist ausschließlich für den
> Adressaten bestimmt. Der Inhalt der E-Mail ist vertraulich. Falls Sie diese E-Mail versehentlich
> erhalten haben, rufen Sie uns unter obiger Rufnummer umgehend an und löschen Sie diese Nachricht
> von Ihrem Computer. Jegliche Art von Reproduktionen, Verbreitung, Vervielfältigung, Veränderung,
> Verteilung und/oder Veröffentlichung dieser E-Mail ist verboten.
> 
> 
> _______________________________________________
> geonode-users mailing list
> geonode-users at lists.osgeo.org <mailto:geonode-users at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/geonode-users <https://lists.osgeo.org/mailman/listinfo/geonode-users>
> 
> 
> 
> --
> Paolo Corti
> Geospatial software developer
> web: http://www.paolocorti.net <http://www.paolocorti.net/>
> twitter: @capooti
> skype: capooti
> 
> 
> 
> 
> --
> Paolo Corti
> Geospatial software developer
> web: http://www.paolocorti.net <http://www.paolocorti.net/>
> twitter: @capooti
> skype: capooti
> 
> 
> This message may contain confidential information. If you are not the designated recipient, please notify the sender immediately, and delete the original and any copies. Any use of the message by you is prohibited.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20171116/12a9f9f3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20171116/12a9f9f3/attachment-0001.sig>


More information about the geonode-users mailing list