Skip to content

Commit

Permalink
Allow adminstrator teams members to see other teams (#18918)
Browse files Browse the repository at this point in the history
* Allow adminstrator teams to see other teams

- Allow team members with adminstrator access, to view other teams.
- Resolves #18885
  • Loading branch information
Gusted authored Feb 26, 2022
1 parent aa60cd9 commit 962725c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/context/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,23 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {

// Team.
if ctx.Org.IsMember {
shouldSeeAllTeams := false
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()
if err != nil {
ctx.ServerError("LoadTeams", err)
Expand Down

0 comments on commit 962725c

Please sign in to comment.