The query on the cb should be more or less ok. The big difference is that it's fetching all the data a user has permission then dumps them in bulk. In your case it will fetch all the data then loop over each of them to see whether the user has permission or not and add a "permitted " field on the API on the fly. That loop is what we avoided by customizing the API. <span></span><br><br>Il venerdì 19 giugno 2015, FERRARI Hugo <<a href="mailto:ferrari_hugo@yahoo.fr">ferrari_hugo@yahoo.fr</a>> ha scritto:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<br>
<blockquote type="cite">
<div> It works pretty well the way I did,
but I understand the problem. <br>
There is no perfomance decrease yet it is probably because i'm
in the developpement stage with few users, not in production.<br>
When you say it slows down the API, is it because it produces
many more SQL requests on the DB ? <br>
(ie Having a first result from the db, then making new queries
to obtain the user-resource-permision value)<br>
Can a solution be to build a <a href="https://docs.djangoproject.com/en/1.8/topics/db/sql/" target="_blank">raw
SQL query</a> a bit more complex ? <br>
create a special view with a join between user, resource and
perms then request it... only reading it, never write.<br>
<br>
Thanks<br>
<br>
<br>
Le 18/06/2015 17:09, Simone Dalmasso a écrit :<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi Hugo,
<div>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.</div>
<div>The reasons behind that are:</div>
<div>- 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.</div>
<div>- 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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2015-06-18 13:38 GMT+02:00 FERRARI
Hugo <span dir="ltr"><<a href="javascript:_e(%7B%7D,'cvml','ferrari_hugo@yahoo.fr');" target="_blank">ferrari_hugo@yahoo.fr</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello
everyone<br>
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.<br>
Then I add some restrictions to allow only a few users to
explore it:<br>
what I mean by "exploring it" is displaying the
geoexplorer frame for layers and giving auth to download
it.<br>
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.<br>
<br>
To improve the user experience I want to make a
distinction on resource lists:<br>
when a resource is only "viewable" (ie displayed in the
list but with no permision to download it),<br>
it displays a "restricted access" message in the
resource-base-snippet template, near the MD infos and
thumbnail.<br>
So the user will be aware that he has no right to retrieve
it directly without contact the PoC.<br>
<br>
To do that I modify JSON answer from the server when we
ask him to get the list of available resources:<br>
the answer is built in create_response method from
CommonModelApi in api module.<br>
We can see that a single resource retrieved from the db is
sent back with some Metadata-fields.<br>
I just want to put a single boolean that will tell if user
has the right to download it.<br>
<br>
I have already written the short function to get this
boolean, but as a template tag, used in the resources
detail templates.<br>
So i 'll have to write an other function to use it the
python module.<br>
It will produce duplicate code.<br>
<br>
Do you have some advice to do it in a better way ?<br>
<br>
Thanks,<br>
Hugo FERRARI<br>
<br>
<br>
Le 17/06/2015 23:00, <a href="javascript:_e(%7B%7D,'cvml','geonode-users-request@lists.osgeo.org');" target="_blank">geonode-users-request@lists.osgeo.org</a>
a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Send
geonode-users mailing list submissions to<br>
<a href="javascript:_e(%7B%7D,'cvml','geonode-users@lists.osgeo.org');" target="_blank">geonode-users@lists.osgeo.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web,
visit<br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/geonode-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/geonode-users</a><br>
or, via email, send a message with subject or body
'help' to<br>
<a href="javascript:_e(%7B%7D,'cvml','geonode-users-request@lists.osgeo.org');" target="_blank">geonode-users-request@lists.osgeo.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="javascript:_e(%7B%7D,'cvml','geonode-users-owner@lists.osgeo.org');" target="_blank">geonode-users-owner@lists.osgeo.org</a><br>
<br>
When replying, please edit your Subject line so it is
more specific<br>
than "Re: Contents of geonode-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Cannot find /var/lib/geonode/ to get templates
(William Francis)<br>
2. Re: Query on a medium sized postgis table layer
takes forever<br>
on 2.4b25 (Paolo Corti)<br>
3. Implementing GeoNode for University (Florian
Hoedt)<br>
4. Re: Query on a medium sized postgis table layer
takes forever<br>
on 2.4b25 (Francesco Bartoli)<br>
5. Bad Thumbnail png files (Miguel-Angel
Manso-Callejo (UPM))<br>
6. Re: Bad Thumbnail png files (Simone Dalmasso)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Wed, 17 Jun 2015 19:24:51 +0630<br>
From: William Francis <<a href="javascript:_e(%7B%7D,'cvml','william.francis.james@gmail.com');" target="_blank">william.francis.james@gmail.com</a>><br>
To: <a href="javascript:_e(%7B%7D,'cvml','geonode-users@lists.osgeo.org');" target="_blank">geonode-users@lists.osgeo.org</a><br>
Subject: [GeoNode-users] Cannot find /var/lib/geonode/
to get<br>
templates<br>
Message-ID:<br>
<<a href="javascript:_e(%7B%7D,'cvml','CAD0vh4b%2Ba6wKWaLRO-XcFxJB5ccGmfHLpbpSAXtp5p3VAs2k6g@mail.gmail.com');" target="_blank">CAD0vh4b+a6wKWaLRO-XcFxJB5ccGmfHLpbpSAXtp5p3VAs2k6g@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hello,<br>
<br>
I am following the Customizing the geonode instructions
and looking for the<br>
template files to copy to etc/geonode/templates<br>
<br>
e.g.<br>
<br>
/var/lib/geonode/src/GeoNodePy/geonode/templates/index.html<br>
<br>
However the directory /var/lib/geonode/ doesn't exist.<br>
<br>
<br>
Where can I find a copy of these templates?<br>
<br>
I am using v*ersion 2.4b25* of geonode.<br>
<br>
Thank you.<br>
<br>
Will<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.osgeo.org/pipermail/geonode-users/attachments/20150617/e56cd76e/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.osgeo.org/pipermail/geonode-users/attachments/20150617/e56cd76e/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Wed, 17 Jun 2015 15:36:35 +0200<br>
From: Paolo Corti <<a href="javascript:_e(%7B%7D,'cvml','pcorti@gmail.com');" target="_blank">pcorti@gmail.com</a>><br>
To: Rainer Lissewski <<a href="javascript:_e(%7B%7D,'cvml','rainerlissewski@gmail.com');" target="_blank">rainerlissewski@gmail.com</a>><br>
Cc: "<a href="javascript:_e(%7B%7D,'cvml','geonode-users@lists.osgeo.org');" target="_blank">geonode-users@lists.osgeo.org</a>"
<<a href="javascript:_e(%7B%7D,'cvml','geonode-users@lists.osgeo.org');" target="_blank">geonode-users@lists.osgeo.org</a>><br>
Subject: Re: [GeoNode-users] Query on a medium sized
postgis table<br>
layer takes forever on 2.4b25<br>
Message-ID:<br>
<<a href="javascript:_e(%7B%7D,'cvml','CAHXrU-Jo1L19VAFGZyS%2Bi6WYMm2wtO693KTjBw6F18OqAzCkzA@mail.gmail.com');" target="_blank">CAHXrU-Jo1L19VAFGZyS+i6WYMm2wtO693KTjBw6F18OqAzCkzA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=UTF-8<br>
<br>
On Wed, Jun 17, 2015 at 2:30 PM, Rainer Lissewski<br>
<<a href="javascript:_e(%7B%7D,'cvml','rainerlissewski@gmail.com');" target="_blank">rainerlissewski@gmail.com</a>>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hi,
in the map view, I have tried to query a single
attribute value<br>
(varchar) from a layer with about 5000 rows, and it
has been running over an<br>
hour now, with no result. If someone can guide me
where to look for the<br>
possible culprit (geoserver, django,...), I would
gladly take any hints<br>
<br>
</blockquote>
Things I would check (in this order):<br>
* response to the getfeatureinfo request using your
browser debug toolbar<br>
* geoserver log<br>
* try the query in postgis and check it using EXPLAIN<br>
<br>
regards<br>
p<br>
<br>
<br>
<br>
</blockquote>
<br>
_______________________________________________<br>
geonode-users mailing list<br>
<a href="javascript:_e(%7B%7D,'cvml','geonode-users@lists.osgeo.org');" target="_blank">geonode-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/geonode-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/geonode-users</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>Simone </div>
</div>
</blockquote>
<br>
</blockquote>
<br>
</div>
</blockquote><br><br>-- <br>Simone <br>