Fix public browsing
This commit is contained in:
parent
d87dc232e2
commit
294d02a595
1 changed files with 6 additions and 7 deletions
|
@ -27,8 +27,10 @@ def welcome():
|
|||
|
||||
|
||||
@app.route('/api/user/')
|
||||
@login_required
|
||||
def get_logged_in_user():
|
||||
if current_user.is_anonymous():
|
||||
return jsonify({'anonymous': True})
|
||||
|
||||
user = current_user.db_user
|
||||
return jsonify({
|
||||
'verified': user.verified,
|
||||
|
@ -40,6 +42,7 @@ def get_logged_in_user():
|
|||
|
||||
|
||||
@app.route('/api/users/<prefix>', methods=['GET'])
|
||||
@login_required
|
||||
def get_matching_users(prefix):
|
||||
users = model.get_matching_users(prefix)
|
||||
|
||||
|
@ -55,7 +58,6 @@ def create_repo_api():
|
|||
|
||||
|
||||
@app.route('/api/repository/find/<prefix>', methods=['GET'])
|
||||
@login_required
|
||||
def match_repos_api(prefix):
|
||||
def repo_view(repo):
|
||||
return {
|
||||
|
@ -64,7 +66,7 @@ def match_repos_api(prefix):
|
|||
'description': repo.description
|
||||
}
|
||||
|
||||
username = current_user.db_user.username
|
||||
username = current_user.db_user.username if current_user.is_authenticated() else None
|
||||
matching = model.get_matching_repositories(prefix, username)
|
||||
response = {
|
||||
'repositories': [repo_view(repo) for repo in matching]
|
||||
|
@ -74,7 +76,6 @@ def match_repos_api(prefix):
|
|||
|
||||
|
||||
@app.route('/api/repository/', methods=['GET'])
|
||||
@login_required
|
||||
def list_repos_api():
|
||||
def repo_view(repo_obj):
|
||||
return {
|
||||
|
@ -83,7 +84,7 @@ def list_repos_api():
|
|||
'description': repo_obj.description,
|
||||
}
|
||||
|
||||
username = current_user.db_user.username
|
||||
username = current_user.db_user.username if current_user.is_authenticated() else None
|
||||
repos = [repo_view(repo)
|
||||
for repo in model.get_visible_repositories(username)]
|
||||
response = {
|
||||
|
@ -137,7 +138,6 @@ def image_view(image):
|
|||
|
||||
|
||||
@app.route('/api/repository/<path:repository>', methods=['GET'])
|
||||
@login_required
|
||||
@parse_repository_name
|
||||
def get_repo_api(namespace, repository):
|
||||
logger.debug('Get repo: %s/%s' % (namespace, repository))
|
||||
|
@ -183,7 +183,6 @@ def role_view(repo_perm_obj):
|
|||
|
||||
@app.route('/api/repository/<path:repository>/tag/<tag>/images',
|
||||
methods=['GET'])
|
||||
@login_required
|
||||
@parse_repository_name
|
||||
def list_tag_images(namespace, repository, tag):
|
||||
permission = ReadRepositoryPermission(namespace, repository)
|
||||
|
|
Reference in a new issue