Allow adminstrator teams members to see other teams (#18918)
This commit is contained in:
parent
ce75461380
commit
df35049196
1 changed files with 16 additions and 0 deletions
|
@ -129,7 +129,23 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
|
||||||
|
|
||||||
// Team.
|
// Team.
|
||||||
if ctx.Org.IsMember {
|
if ctx.Org.IsMember {
|
||||||
|
shouldSeeAllTeams := false
|
||||||
if ctx.Org.IsOwner {
|
if ctx.Org.IsOwner {
|
||||||
|
shouldSeeAllTeams = true
|
||||||
|
} else {
|
||||||
|
teams, err := org.GetUserTeams(ctx.User.ID)
|
||||||
|
if err != nil {
|
||||||
|
ctx.ServerError("GetUserTeams", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, team := range teams {
|
||||||
|
if team.IncludesAllRepositories && team.AccessMode >= perm.AccessModeAdmin {
|
||||||
|
shouldSeeAllTeams = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if shouldSeeAllTeams {
|
||||||
ctx.Org.Teams, err = org.LoadTeams()
|
ctx.Org.Teams, err = org.LoadTeams()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("LoadTeams", err)
|
ctx.ServerError("LoadTeams", err)
|
||||||
|
|
Reference in a new issue