diff --git a/data/model/repository.py b/data/model/repository.py index 4844efc53..368dfab24 100644 --- a/data/model/repository.py +++ b/data/model/repository.py @@ -179,6 +179,9 @@ def get_action_counts(repository_ids): def get_visible_repositories(username=None, include_public=True, page=None, limit=None, namespace=None, namespace_only=False): + if not include_public and not username: + return [] + fields = [Repository.name, Repository.id, Repository.description, Visibility.name, Namespace.username] diff --git a/test/test_api_usage.py b/test/test_api_usage.py index ebab4a24f..dfadf75d5 100644 --- a/test/test_api_usage.py +++ b/test/test_api_usage.py @@ -1305,6 +1305,15 @@ class TestListRepos(ApiTestCase): for repo in json['repositories']: self.assertEquals(ORGANIZATION, repo['namespace']) + def test_listrepos_asguest_allparams(self): + json = self.getJsonResponse(RepositoryList, + params=dict(namespace=ORGANIZATION, + public=False, + last_modified=True)) + + for repo in json['repositories']: + self.assertEquals(ORGANIZATION, repo['namespace']) + class TestViewPublicRepository(ApiTestCase): def test_normalview(self):