Merge branch 'orgs' of https://bitbucket.org/yackob03/quay into orgs
This commit is contained in:
commit
a3970fa75c
4 changed files with 20 additions and 17 deletions
|
@ -112,9 +112,17 @@ def create_team(name, org, team_role_name, description=''):
|
||||||
description=description)
|
description=description)
|
||||||
|
|
||||||
|
|
||||||
def remove_team(name, org):
|
def remove_team(org_name, team_name):
|
||||||
# TODO: have code to remove the team, and all its repo permissions, etc.
|
found = list(Team.select().join(User).where(User.organization == True,
|
||||||
pass
|
User.username == org_name,
|
||||||
|
Team.name == team_name))
|
||||||
|
if not found:
|
||||||
|
raise InvalidTeamException('Team named: %s is not a team in org: %s' %
|
||||||
|
(team_name, org_name))
|
||||||
|
|
||||||
|
team = found[0]
|
||||||
|
team.delete_instance(recursive=True, delete_nullable=True)
|
||||||
|
|
||||||
|
|
||||||
def add_user_to_team(user, team):
|
def add_user_to_team(user, team):
|
||||||
return TeamMember.create(user=user, team=team)
|
return TeamMember.create(user=user, team=team)
|
||||||
|
@ -207,7 +215,7 @@ def validate_reset_code(code):
|
||||||
|
|
||||||
def get_user(username):
|
def get_user(username):
|
||||||
try:
|
try:
|
||||||
return User.get(User.username == username)
|
return User.get(User.username == username, User.organization == False)
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -346,9 +346,9 @@ def update_organization_team(orgname, teamname):
|
||||||
@app.route('/api/organization/<orgname>/team/<teamname>',
|
@app.route('/api/organization/<orgname>/team/<teamname>',
|
||||||
methods=['DELETE'])
|
methods=['DELETE'])
|
||||||
def delete_organization_team(orgname, teamname):
|
def delete_organization_team(orgname, teamname):
|
||||||
edit_permission = AdministerOrganizationPermission(orgname)
|
permission = AdministerOrganizationPermission(orgname)
|
||||||
if edit_permission.can():
|
if permission.can():
|
||||||
model.remove_team(teamname, orgname)
|
model.remove_team(orgname, teamname)
|
||||||
return make_response('Deleted', 204)
|
return make_response('Deleted', 204)
|
||||||
|
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
|
@ -1418,7 +1418,6 @@ p.editable:hover i {
|
||||||
|
|
||||||
.org-view .header-col {
|
.org-view .header-col {
|
||||||
color: #444;
|
color: #444;
|
||||||
padding-left: 30px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.org-view .header-col dd {
|
.org-view .header-col dd {
|
||||||
|
|
|
@ -11,9 +11,8 @@
|
||||||
<button class="btn btn-success"><i class="fa fa-group"></i> Create Team</button>
|
<button class="btn btn-success"><i class="fa fa-group"></i> Create Team</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row visible-md visible-lg">
|
<div class="row hidden-xs">
|
||||||
<div class="col-md-7"></div>
|
<div class="col-md-4 col-md-offset-8 col-sm-5 col-sm-offset-7 header-col" ng-show="organization.is_admin">
|
||||||
<div class="col-md-3 header-col" ng-show="organization.is_admin">
|
|
||||||
Team Permissions
|
Team Permissions
|
||||||
<i class="info-icon fa fa-info-circle" data-placement="bottom" data-original-title="" title=""
|
<i class="info-icon fa fa-info-circle" data-placement="bottom" data-original-title="" title=""
|
||||||
data-content="Global permissions for the team and its members<br><br><dl><dt>Member</dt><dd>Permissions are assigned on a per repository basis</dd><dt>Creator</dt><dd>A team can create its own repositories</dd><dt>Admin</dt><dd>A team has full control of the organization</dd></dl>"></i>
|
data-content="Global permissions for the team and its members<br><br><dl><dt>Member</dt><dd>Permissions are assigned on a per repository basis</dd><dt>Creator</dt><dd>A team can create its own repositories</dd><dt>Admin</dt><dd>A team has full control of the organization</dd></dl>"></i>
|
||||||
|
@ -22,7 +21,7 @@
|
||||||
|
|
||||||
<div class="team-listing" ng-repeat="(name, team) in organization.teams">
|
<div class="team-listing" ng-repeat="(name, team) in organization.teams">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-7">
|
<div class="col-sm-7 col-md-8">
|
||||||
<div class="team-title">
|
<div class="team-title">
|
||||||
<i class="fa fa-group"></i>
|
<i class="fa fa-group"></i>
|
||||||
<span ng-show="team.can_view">
|
<span ng-show="team.can_view">
|
||||||
|
@ -36,12 +35,9 @@
|
||||||
<div class="team-description markdown-view" content="team.description" first-line-only="true"></div>
|
<div class="team-description markdown-view" content="team.description" first-line-only="true"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3 control-col" ng-show="organization.is_admin">
|
<div class="col-sm-5 col-md-4 control-col" ng-show="organization.is_admin">
|
||||||
<span class="role-group" current-role="team.role" role-changed="setRole(role, team.name)" roles="teamRoles"></span>
|
<span class="role-group" current-role="team.role" role-changed="setRole(role, team.name)" roles="teamRoles"></span>
|
||||||
</div>
|
<button class="btn btn-sm btn-danger" ng-click="askDeleteTeam(team.name)">Delete Team</button>
|
||||||
|
|
||||||
<div class="col-md-1 control-col delete-col" ng-show="organization.is_admin">
|
|
||||||
<button class="btn btn-danger" ng-click="askDeleteTeam(team.name)">Delete Team</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in a new issue