Commit 804614ba authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added owner category public.

parent ed9049b0
......@@ -84,7 +84,7 @@ repo_calcs_model = api.model('RepoCalculations', {
repo_request_parser = pagination_request_parser.copy()
'owner', type=str,
help='Specify which calcs to return: ``all``, ``user``, ``staging``, default is ``all``')
help='Specify which calcs to return: ``all``, ``public``, ``user``, ``staging``, default is ``all``')
'scroll', type=bool, help='Enable scrolling')
......@@ -115,6 +115,10 @@ class RepoCalcsResource(Resource):
Search for calculations in the repository from, paginated.
The ``owner`` parameter determines the overall entries to search through.
Possible values are: ``all`` (show all entries visible to the current user), ``public``
(show all publically visible entries), ``user`` (show all user entries, requires login),
``staging`` (show all user entries in staging area, requires login).
You can use the various quantities to search/filter for. For some of the
indexed quantities this endpoint returns aggregation information. This means
you will be given a list of all possible values and the number of entries
......@@ -170,6 +174,8 @@ class RepoCalcsResource(Resource):
q = Q('term', published=True) & Q('term', with_embargo=False)
if g.user is not None:
q = q | Q('term', owners__user_id=g.user.user_id)
elif owner == 'public':
q = Q('term', published=True) & Q('term', with_embargo=False)
elif owner == 'user':
if g.user is None:
abort(401, message='Authentication required for owner value user.')
......@@ -212,6 +218,9 @@ class RepoCalcsResource(Resource):
except KeyError as e:
abort(400, str(e))
import time
return dict(
pagination=dict(total=total, page=page, per_page=per_page),
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment