Skip to content

Commit

Permalink
subdivisions: fix moderator access bug
Browse files Browse the repository at this point in the history
* Solves a problem that prevented a moderator to see the deposits
  of his/her subdivision in the list of deposits.

Co-Authored-by: Miguel Moreira <miguel.moreira@rero.ch>
  • Loading branch information
mmo committed Oct 20, 2021
1 parent 8cc6739 commit a043432
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sonar/modules/deposits/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def search_factory(self, search, query_parser=None):
# subdivision or by owned deposits
if not user.is_admin and user.is_moderator and user.get('subdivision'):
user = user.replace_refs()
search = search.query(
search = search.filter(
'bool',
should=[
Q('term', subdivision__pid=user['subdivision']['pid']),
Q('term', user__subdivision__pid=user['subdivision']['pid']),
Q('term', user__pid=user['pid'])
])

Expand Down

0 comments on commit a043432

Please sign in to comment.