Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add team option to grant rights for all organization repositories #8688

Merged
merged 27 commits into from
Nov 6, 2019
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0b8e90e
Add field IsAllRepositories to team
ngourdon Apr 28, 2019
b478a10
Add AllRepositories to team UI
ngourdon Apr 28, 2019
e5f6d9e
Manage team with access to all repositories
ngourdon Apr 28, 2019
7cca125
Add field IsAllRepositories to team API
ngourdon Apr 28, 2019
a02aa18
put backticks around table/column names
ngourdon Apr 30, 2019
8216a2a
rename IsAllRepositories to IncludesAllRepositories
ngourdon Apr 30, 2019
f698385
do not reload slice if already loaded
ngourdon Apr 30, 2019
0496588
add repo to teams with access to all repositories when changing repo …
ngourdon May 8, 2019
c097a29
improve tests for teams with access to all repositories
ngourdon May 8, 2019
3a3ccf8
Merge branch 'master'
ngourdon May 8, 2019
5fa75d4
Merge branch 'master'
ngourdon May 9, 2019
d262016
Merge branch 'master' into fix-6409
ngourdon May 12, 2019
8f297ca
Merge branch 'master' into fix-6409
ngourdon Jul 11, 2019
550cbcc
Change code for adding all repositories
davidsvantesson Oct 5, 2019
5316bdf
Merge remote-tracking branch 'upstream/master' into team-grant-all-repos
davidsvantesson Oct 5, 2019
c1a2e26
fmt after merge
davidsvantesson Oct 5, 2019
cfeb1c3
Change code in API EditTeam similar to EditTeamPost web interface
davidsvantesson Oct 5, 2019
06ac307
Clarify that all repositories will be added
davidsvantesson Oct 5, 2019
3f291df
Merge remote-tracking branch 'upstream/master' into team-grant-all-repos
davidsvantesson Oct 25, 2019
5f6a701
All repositories option under Permissions headline
davidsvantesson Oct 25, 2019
c4546cd
New setting group 'Repository access'
davidsvantesson Oct 26, 2019
ee52d2d
Merge remote-tracking branch 'upstream/master' into team-grant-all-re…
davidsvantesson Oct 26, 2019
753b7d2
Move check IncludeAllRepositories to removeRepository.
davidsvantesson Nov 2, 2019
7c7fa0d
Revert "Move check IncludeAllRepositories to removeRepository." and a…
davidsvantesson Nov 2, 2019
30faed9
Merge branch 'master' into team-grant-all-repos
davidsvantesson Nov 2, 2019
ad2d925
Clarify help text what options do.
davidsvantesson Nov 3, 2019
4a509e8
Merge branch 'master' into team-grant-all-repos
lafriks Nov 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change code in API EditTeam similar to EditTeamPost web interface
Signed-off-by: David Svantesson <[email protected]>
  • Loading branch information
davidsvantesson committed Oct 5, 2019
commit cfeb1c32264e4a12eab6907afd53d4004e53a5a7
23 changes: 19 additions & 4 deletions routers/api/v1/org/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,27 @@ func EditTeam(ctx *context.APIContext, form api.EditTeamOption) {
// "200":
// "$ref": "#/responses/Team"
team := ctx.Org.Team
team.Name = form.Name
team.Description = form.Description
team.IncludesAllRepositories = form.IncludesAllRepositories
team.Authorize = models.ParseAccessMode(form.Permission)
unitTypes := models.FindUnitTypes(form.Units...)

isAuthChanged := false
isIncludeAllChanged := false
if !team.IsOwnerTeam() {
// Validate permission level.
auth := models.ParseAccessMode(form.Permission)

team.Name = form.Name
if team.Authorize != auth {
isAuthChanged = true
team.Authorize = auth
}

if team.IncludesAllRepositories != form.IncludesAllRepositories {
isIncludeAllChanged = true
team.IncludesAllRepositories = form.IncludesAllRepositories
}
}

if team.Authorize < models.AccessModeOwner {
var units = make([]*models.TeamUnit, 0, len(form.Units))
for _, tp := range unitTypes {
Expand All @@ -200,7 +215,7 @@ func EditTeam(ctx *context.APIContext, form api.EditTeamOption) {
team.Units = units
}

if err := models.UpdateTeam(team, true, true); err != nil {
if err := models.UpdateTeam(team, isAuthChanged, isIncludeAllChanged); err != nil {
ctx.Error(500, "EditTeam", err)
return
}
Expand Down