Skip to content

Commit

Permalink
Use correct attribute to get the role from a user object
Browse files Browse the repository at this point in the history
  • Loading branch information
llienher committed May 19, 2021
1 parent 182635c commit b824521
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions geoportal/geoportailv3_geoportal/views/fulltextsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def fulltextsearch(self):
if self.request.user is None:
filters['must'].append({"term": {"public": True}})
else:
role_id = self.request.user.role.id
role_id = self.request.user.settings_role.id
filters['should'].append({"term": {"public": True}})
filters['should'].append({"term": {"role_id": role_id}})

Expand Down Expand Up @@ -234,7 +234,7 @@ def layersearch(self):
if self.request.user is None:
filters['must'].append({"term": {"public": True}})
else:
role_id = self.request.user.role.id
role_id = self.request.user.settings_role.id
filters['should'].append({"term": {"public": True}})
filters['should'].append({"term": {"role_id": role_id}})

Expand Down
2 changes: 1 addition & 1 deletion geoportal/geoportailv3_geoportal/views/luxprintproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def _is_authorized(self, internal_wms):
else:
restriction = DBSession.query(RestrictionArea).filter(
RestrictionArea.roles.any(
Role.id == self.request.user.role.id)).filter(
Role.id == self.request.user.settings_role.id)).filter(
RestrictionArea.layers.any(
Layer.id == internal_wms.id
)
Expand Down
2 changes: 1 addition & 1 deletion geoportal/geoportailv3_geoportal/views/wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def internal_proxy_wms(self):
# Check if the layer has a restriction area
restriction: Optional[RestrictionArea] = DBSession.query(RestrictionArea).filter(
RestrictionArea.roles.any(
Role.id == self.request.user.role.id)).filter(
Role.id == self.request.user.settings_role.id)).filter(
RestrictionArea.layers.any(
Layer.id == internal_wms.id
)
Expand Down

0 comments on commit b824521

Please sign in to comment.