24 lines
754 B
Python
24 lines
754 B
Python
from flask import jsonify
|
|
|
|
from auth.registry_jwt_auth import process_registry_jwt_auth, get_granted_entity
|
|
from endpoints.decorators import anon_protect
|
|
from endpoints.v2 import v2_bp, paginate
|
|
|
|
@v2_bp.route('/_catalog', methods=['GET'])
|
|
@process_registry_jwt_auth()
|
|
@anon_protect
|
|
@paginate()
|
|
def catalog_search(limit, offset, pagination_callback):
|
|
username = None
|
|
entity = get_granted_entity()
|
|
if entity:
|
|
username = entity.user.username
|
|
|
|
visible_repositories = v2.get_visible_repositories(username, limit, offset)
|
|
response = jsonify({
|
|
'repositories': ['%s/%s' % (repo.namespace_name, repo.name)
|
|
for repo in visible_repositories],
|
|
})
|
|
|
|
pagination_callback(len(visible_repositories), response)
|
|
return response
|