Skip to content

Commit 962725c

Browse files
author
Gusted
authored
Allow adminstrator teams members to see other teams (#18918)
* Allow adminstrator teams to see other teams - Allow team members with adminstrator access, to view other teams. - Resolves #18885
1 parent aa60cd9 commit 962725c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

modules/context/org.go

+16
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,23 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
129129

130130
// Team.
131131
if ctx.Org.IsMember {
132+
shouldSeeAllTeams := false
132133
if ctx.Org.IsOwner {
134+
shouldSeeAllTeams = true
135+
} else {
136+
teams, err := org.GetUserTeams(ctx.User.ID)
137+
if err != nil {
138+
ctx.ServerError("GetUserTeams", err)
139+
return
140+
}
141+
for _, team := range teams {
142+
if team.IncludesAllRepositories && team.AccessMode >= perm.AccessModeAdmin {
143+
shouldSeeAllTeams = true
144+
break
145+
}
146+
}
147+
}
148+
if shouldSeeAllTeams {
133149
ctx.Org.Teams, err = org.LoadTeams()
134150
if err != nil {
135151
ctx.ServerError("LoadTeams", err)

0 commit comments

Comments
 (0)