[GeoNode-users] modifying the layer list request

FERRARI Hugo ferrari_hugo at yahoo.fr
Thu Jun 18 23:25:46 PDT 2015


> It works pretty well the way I did, but I understand the  problem.
> There is no perfomance decrease yet it is probably because i'm in the 
> developpement stage with few users, not in production.
> When you say it slows down the API, is it because it produces many 
> more SQL requests on the DB ?
> (ie Having a first result from the db, then making new queries to 
> obtain the user-resource-permision value)
> Can a solution  be to build a raw SQL query 
> <https://docs.djangoproject.com/en/1.8/topics/db/sql/> a bit more 
> complex ?
> create a special view with a join between user, resource and perms 
> then request it... only reading it, never write.
>
> Thanks
>
>
> Le 18/06/2015 17:09, Simone Dalmasso a écrit :
>> Hi Hugo,
>> the "easies" way would be to create a dedicated API for non permitted 
>> resources that is used in a separate tab in the search pages dedicate 
>> to resources that are in GeoNode but the user does not have the 
>> permission to view.
>> The reasons behind that are:
>> - The current api, for performances purpose, do not loop over each 
>> result in any way, they just take the data from the db, apply 
>> filters, then send to the client. If you have to distinguish between 
>> permitted and not permitted then you have to add back the post 
>> processing that will slow down the API. Better have a dedicated API 
>> to this task.
>> - In the client side, there's Angular.js that renders the resources 
>> and even if the angular tags look the same as the django ones {{tag}} 
>> they are actually rendered by Angular. The _resourcebase_snippet 
>> works this way, so you cannot use django template tags in there.
>>
>> If you create a separate tab you can use the same logic both on the 
>> client and on the server with just a different api endpoint at the 
>> price of not having the results mixed in the same list.
>>
>> If you decide to activate the API post processing (dehidratation 
>> cycle) then try to keep it as light as possible otherwise the 
>> performances will drop especially if you visualize many data all 
>> together.
>>
>> 2015-06-18 13:38 GMT+02:00 FERRARI Hugo <ferrari_hugo at yahoo.fr 
>> <mailto:ferrari_hugo at yahoo.fr>>:
>>
>>     Hello everyone
>>     I've modified geonode behavior to make every user (logged or not)
>>     to view the complete list of the resources stored in geoserver
>>     and geonode store, and the ability to download the metadatas.
>>     Then I add some restrictions to allow only a few users to explore it:
>>      what I mean by "exploring it" is displaying the geoexplorer
>>     frame for layers and giving auth to download it.
>>     the aim is to show users the whole catalog first, and e-mail the
>>     Point of Contact if a resource cannot be retrivied because of
>>     restriction.
>>
>>     To improve the user experience I want to make a distinction on
>>     resource lists:
>>     when a resource is only "viewable" (ie displayed in the list but
>>     with no permision to download it),
>>      it displays a "restricted access" message in the
>>     resource-base-snippet template, near the MD infos and thumbnail.
>>     So the user will be aware that he has no right to retrieve it
>>     directly without contact the PoC.
>>
>>     To do that I modify JSON answer from the server when we ask him
>>     to get the list of available resources:
>>     the answer is built in create_response method from CommonModelApi
>>     in api module.
>>     We can see that a single resource retrieved from the db is sent
>>     back with some Metadata-fields.
>>     I just want to put a single boolean that will tell if user has
>>     the right to download it.
>>
>>     I have  already written the short function to get this boolean,
>>     but as a template tag, used in the resources detail templates.
>>     So i 'll have to write an other function to use it the python module.
>>     It will produce duplicate code.
>>
>>     Do you have some advice to do it in a better way ?
>>
>>     Thanks,
>>     Hugo FERRARI
>>
>>
>>     Le 17/06/2015 23:00, geonode-users-request at lists.osgeo.org
>>     <mailto:geonode-users-request at lists.osgeo.org> a écrit :
>>
>>         Send geonode-users mailing list submissions to
>>         geonode-users at lists.osgeo.org
>>         <mailto:geonode-users at lists.osgeo.org>
>>
>>         To subscribe or unsubscribe via the World Wide Web, visit
>>         http://lists.osgeo.org/cgi-bin/mailman/listinfo/geonode-users
>>         or, via email, send a message with subject or body 'help' to
>>         geonode-users-request at lists.osgeo.org
>>         <mailto:geonode-users-request at lists.osgeo.org>
>>
>>         You can reach the person managing the list at
>>         geonode-users-owner at lists.osgeo.org
>>         <mailto:geonode-users-owner at lists.osgeo.org>
>>
>>         When replying, please edit your Subject line so it is more
>>         specific
>>         than "Re: Contents of geonode-users digest..."
>>
>>
>>         Today's Topics:
>>
>>             1. Cannot find /var/lib/geonode/ to get templates
>>         (William Francis)
>>             2. Re: Query on a medium sized postgis table layer takes
>>         forever
>>                on 2.4b25 (Paolo Corti)
>>             3. Implementing GeoNode for University (Florian Hoedt)
>>             4. Re: Query on a medium sized postgis table layer takes
>>         forever
>>                on 2.4b25 (Francesco Bartoli)
>>             5. Bad Thumbnail png files (Miguel-Angel Manso-Callejo (UPM))
>>             6. Re: Bad Thumbnail png files (Simone Dalmasso)
>>
>>
>>         ----------------------------------------------------------------------
>>
>>         Message: 1
>>         Date: Wed, 17 Jun 2015 19:24:51 +0630
>>         From: William Francis <william.francis.james at gmail.com
>>         <mailto:william.francis.james at gmail.com>>
>>         To: geonode-users at lists.osgeo.org
>>         <mailto:geonode-users at lists.osgeo.org>
>>         Subject: [GeoNode-users] Cannot find /var/lib/geonode/ to get
>>                 templates
>>         Message-ID:
>>                
>>         <CAD0vh4b+a6wKWaLRO-XcFxJB5ccGmfHLpbpSAXtp5p3VAs2k6g at mail.gmail.com
>>         <mailto:CAD0vh4b%2Ba6wKWaLRO-XcFxJB5ccGmfHLpbpSAXtp5p3VAs2k6g at mail.gmail.com>>
>>         Content-Type: text/plain; charset="utf-8"
>>
>>         Hello,
>>
>>         I am following the Customizing the geonode instructions and
>>         looking for the
>>         template files to copy to etc/geonode/templates
>>
>>         e.g.
>>
>>         /var/lib/geonode/src/GeoNodePy/geonode/templates/index.html
>>
>>         However the directory  /var/lib/geonode/ doesn't exist.
>>
>>
>>         Where can I find a copy of these templates?
>>
>>         I am using v*ersion 2.4b25*  of geonode.
>>
>>         Thank you.
>>
>>         Will
>>         -------------- next part --------------
>>         An HTML attachment was scrubbed...
>>         URL:
>>         <http://lists.osgeo.org/pipermail/geonode-users/attachments/20150617/e56cd76e/attachment-0001.html>
>>
>>         ------------------------------
>>
>>         Message: 2
>>         Date: Wed, 17 Jun 2015 15:36:35 +0200
>>         From: Paolo Corti <pcorti at gmail.com <mailto:pcorti at gmail.com>>
>>         To: Rainer Lissewski <rainerlissewski at gmail.com
>>         <mailto:rainerlissewski at gmail.com>>
>>         Cc: "geonode-users at lists.osgeo.org
>>         <mailto:geonode-users at lists.osgeo.org>"
>>         <geonode-users at lists.osgeo.org
>>         <mailto:geonode-users at lists.osgeo.org>>
>>         Subject: Re: [GeoNode-users] Query on a medium sized postgis
>>         table
>>                 layer takes forever on 2.4b25
>>         Message-ID:
>>                
>>         <CAHXrU-Jo1L19VAFGZyS+i6WYMm2wtO693KTjBw6F18OqAzCkzA at mail.gmail.com
>>         <mailto:CAHXrU-Jo1L19VAFGZyS%2Bi6WYMm2wtO693KTjBw6F18OqAzCkzA at mail.gmail.com>>
>>         Content-Type: text/plain; charset=UTF-8
>>
>>         On Wed, Jun 17, 2015 at 2:30 PM, Rainer Lissewski
>>         <rainerlissewski at gmail.com
>>         <mailto:rainerlissewski at gmail.com>> wrote:
>>
>>             Hi, in the map view, I have tried to query a single
>>             attribute value
>>             (varchar) from a layer with about 5000 rows, and it has
>>             been running over an
>>             hour now, with no result. If someone can guide me where
>>             to look for the
>>             possible culprit (geoserver, django,...), I would gladly
>>             take any hints
>>
>>         Things I would check (in this order):
>>         * response to the getfeatureinfo request using your browser
>>         debug toolbar
>>         * geoserver log
>>         * try the query in postgis and check it using EXPLAIN
>>
>>         regards
>>         p
>>
>>
>>
>>
>>     _______________________________________________
>>     geonode-users mailing list
>>     geonode-users at lists.osgeo.org <mailto:geonode-users at lists.osgeo.org>
>>     http://lists.osgeo.org/cgi-bin/mailman/listinfo/geonode-users
>>
>>
>>
>>
>> -- 
>> Simone
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20150619/62400200/attachment.html>


More information about the geonode-users mailing list