summaryrefslogtreecommitdiffstats
path: root/modules/context/org.go
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-02-26 20:12:01 +0000
committerGitHub <noreply@github.com>2022-02-26 21:12:01 +0100
commit962725cdbbe954e15b480b2ea1f418a981a7ffe3 (patch)
tree41843de66016e26f6ce9c9e7c1f91e6f48263bad /modules/context/org.go
parentaa60cd91b2ba1d00446144f47214f96fe46466f1 (diff)
downloadgitea-962725cdbbe954e15b480b2ea1f418a981a7ffe3.tar.gz
gitea-962725cdbbe954e15b480b2ea1f418a981a7ffe3.zip
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
Diffstat (limited to 'modules/context/org.go')
-rw-r--r--modules/context/org.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/context/org.go b/modules/context/org.go
index 585a5fd762..824f22b2f3 100644
--- a/modules/context/org.go
+++ b/modules/context/org.go
@@ -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)