Skip to content

Commit df35049

Browse files
author
Gusted
authored
Allow adminstrator teams members to see other teams (#18918) (#18919)
Allow adminstrator teams members to see other teams (#18918)
1 parent ce75461 commit df35049

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

modules/context/org.go

Lines changed: 16 additions & 0 deletions
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)