Skip to content

Commit

Permalink
[Fixes #4404] Performance issue with resource base apis
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed May 16, 2019
1 parent 3a6ebef commit 3cf053b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions geonode/api/resourcebase_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,13 @@ def create_response(
# If an user does not have at least view permissions, he won't be able
# to see the resource at all.
filtered_objects_ids = None
if response_objects:
filtered_objects_ids = [
item.id for item in response_objects if request.user.has_perm(
'view_resourcebase', item.get_self_resource())]
try:
if data['objects']:
filtered_objects_ids = [
item.id for item in data['objects'] if request.user.has_perm(
'view_resourcebase', item.get_self_resource())]
except BaseException:
pass

if isinstance(
data,
Expand Down

0 comments on commit 3cf053b

Please sign in to comment.