fix(repo): centralize repository-scoped authorization (#39063)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
bircni
2026-08-26 20:12:53 +08:00
committed by GitHub
co-authored by wxiaoguang
parent 90c43e8e78
commit e21c37703e
27 changed files with 383 additions and 476 deletions
+12
View File
@@ -39,6 +39,18 @@ func (t TeamList) AnyRepoUnitMaxAccess(ctx context.Context, tp unit.Type) perm.A
return maxAccess
}
func (t TeamList) HasAllRepoAdminAccess() bool {
for _, team := range t {
if team.IsOwnerTeam() || team.AccessMode == perm.AccessModeOwner {
return true
}
if team.IncludesAllRepositories && team.AccessMode >= perm.AccessModeAdmin {
return true
}
}
return false
}
// SearchTeamOptions holds the search options
type SearchTeamOptions struct {
db.ListOptions