Skip to content
Snippets Groups Projects
Commit 2cfdbd98 authored by Pablo Panero Vazquez's avatar Pablo Panero Vazquez
Browse files

Add: Make 'access' parameter optional for record endpoint

parent bbd9d336
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,8 @@ from invenio_search import RecordsSearch ...@@ -5,6 +5,8 @@ from invenio_search import RecordsSearch
from invenio_search.api import DefaultFilter from invenio_search.api import DefaultFilter
from flask import request from flask import request
from cern_search_rest_api.modules.cernsearch.utils import get_user_provides
""" """
The Filter emulates the following query: The Filter emulates the following query:
curl -X GET "localhost:9200/_search" -H 'Content-Type: application/json' -d' curl -X GET "localhost:9200/_search" -H 'Content-Type: application/json' -d'
...@@ -61,11 +63,12 @@ def cern_search_filter(): ...@@ -61,11 +63,12 @@ def cern_search_filter():
def get_egroups(): def get_egroups():
egroups = request.args.get('access', None) egroups = request.args.get('access', None)
try: if egroups or (request.path == '/records/' and request.method == 'GET'):
return ['{0}@cern.ch'.format(egroup) for egroup in egroups.split(',')] try:
return ['{0}@cern.ch'.format(egroup) for egroup in egroups.split(',')]
except AttributeError: except AttributeError:
return None return None
return get_user_provides()
class RecordCERNSearch(RecordsSearch): class RecordCERNSearch(RecordsSearch):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment