diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2025-04-08 12:15:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-08 04:15:15 +0000 |
commit | 07c6087878f9b7ce394104ec806069b0c35793be (patch) | |
tree | 0f4274f35d1efc8d6e820d8d9ad8aae876be742b /services/context | |
parent | 8ca51abaddbf0b30c2607b4c4787b34c016a52d9 (diff) | |
download | gitea-07c6087878f9b7ce394104ec806069b0c35793be.tar.gz gitea-07c6087878f9b7ce394104ec806069b0c35793be.zip |
Fix team permission (#34128)
The `team.access_mode` should be either `none` or `admin/owner`.
For non-admin team, the real permissions are provided by `team_unit`.
Diffstat (limited to 'services/context')
-rw-r--r-- | services/context/org.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/services/context/org.go b/services/context/org.go index 992a48afa0..c8b6ed09b7 100644 --- a/services/context/org.go +++ b/services/context/org.go @@ -182,7 +182,7 @@ func OrgAssignment(opts OrgAssignmentOptions) func(ctx *Context) { return } for _, team := range teams { - if team.IncludesAllRepositories && team.AccessMode >= perm.AccessModeAdmin { + if team.IncludesAllRepositories && team.HasAdminAccess() { shouldSeeAllTeams = true break } @@ -228,7 +228,7 @@ func OrgAssignment(opts OrgAssignmentOptions) func(ctx *Context) { return } - ctx.Org.IsTeamAdmin = ctx.Org.Team.IsOwnerTeam() || ctx.Org.Team.AccessMode >= perm.AccessModeAdmin + ctx.Org.IsTeamAdmin = ctx.Org.Team.IsOwnerTeam() || ctx.Org.Team.HasAdminAccess() ctx.Data["IsTeamAdmin"] = ctx.Org.IsTeamAdmin if opts.RequireTeamAdmin && !ctx.Org.IsTeamAdmin { ctx.NotFound(err) |