Add config to enable "public" namespaces

These are namespaces that will be displayed in the repo list view, regardless of whether the user is a member.
This commit is contained in:
Joseph Schorr 2017-08-07 15:59:06 -04:00
parent dff4207a89
commit 650dbe5f5b
3 changed files with 19 additions and 4 deletions

View file

@ -79,6 +79,7 @@ def user_view(user, previous_username=None):
'name': o.username,
'avatar': avatar.get_data_for_org(o),
'can_create_repo': CreateRepositoryPermission(o.username).can(),
'public': o.username in app.config.get('PUBLIC_NAMESPACES', []),
}
if user_admin:
@ -89,7 +90,13 @@ def user_view(user, previous_username=None):
return org_response
organizations = model.organization.get_user_organizations(user.username)
# Retrieve the organizations for the user.
organizations = list(model.organization.get_user_organizations(user.username))
# Add any public namespaces.
public_namespaces = app.config.get('PUBLIC_NAMESPACES', [])
if public_namespaces:
organizations.extend([model.user.get_namespace_user(ns) for ns in public_namespaces])
def login_view(login):
try: