Fix public repository permissions checking.

This commit is contained in:
jakedt 2014-03-26 15:56:51 -04:00
parent 4d2e090bea
commit 8fefe239b5
2 changed files with 4 additions and 2 deletions

View file

@ -133,7 +133,8 @@ class RepositoryList(ApiResource):
namespace=args['namespace'])
response['repositories'] = [repo_view(repo) for repo in repo_query
if ReadRepositoryPermission(repo.namespace, repo.name).can()]
if (repo.visibility.name == 'public' or
ReadRepositoryPermission(repo.namespace, repo.name).can())]
return response

View file

@ -111,5 +111,6 @@ class FindRepositories(ApiResource):
matching = model.get_matching_repositories(prefix, username)
return {
'repositories': [repo_view(repo) for repo in matching
if ReadRepositoryPermission(repo.namespace, repo.name).can()]
if (repo.visibility.name == 'public' or
ReadRepositoryPermission(repo.namespace, repo.name).can())]
}