Add ability for super users to take ownership of namespaces
Fixes #1395
This commit is contained in:
parent
f75949d533
commit
20816804e5
14 changed files with 280 additions and 94 deletions
|
@ -136,3 +136,11 @@ def get_all_repo_users_transitive_via_teams(namespace_name, repository_name):
|
|||
def get_organizations():
|
||||
return User.select().where(User.organization == True, User.robot == False)
|
||||
|
||||
|
||||
def add_user_as_admin(user_obj, org_obj):
|
||||
try:
|
||||
admin_role = TeamRole.get(name='admin')
|
||||
admin_team = Team.select().where(Team.role == admin_role, Team.organization == org_obj).get()
|
||||
team.add_user_to_team(user_obj, admin_team)
|
||||
except team.UserAlreadyInTeam:
|
||||
pass
|
||||
|
|
Reference in a new issue