Merge branch 'orgs' of ssh://bitbucket.org/yackob03/quay into orgs

This commit is contained in:
yackob03 2013-11-07 17:11:10 -05:00
commit 71f7320532
11 changed files with 633 additions and 67 deletions

View file

@ -99,6 +99,22 @@ def create_organization(name, email, creating_user):
raise InvalidOrganizationException('Invalid organization name: %s' % name)
def convert_user_to_organization(user, admin_user):
# Change the user to an organization.
user.organization = True
# TODO: disable this account for login.
user.password = ''
user.save()
# Create a team for the owners
owners_team = create_team('owners', user, 'admin')
# Add the user who will admin the org to the owners team
add_user_to_team(admin_user, owners_team)
return user
def create_team(name, org, team_role_name, description=''):
if not validate_username(name):
raise InvalidTeamException('Invalid team name: %s' % name)