1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-03-03 15:22:25 +02:00
2024-02-11 18:42:33 +01:00

19 lines
431 B
Go

package permissions
import (
"go.woodpecker-ci.org/woodpecker/v2/server/model"
"go.woodpecker-ci.org/woodpecker/v2/shared/utils"
)
func NewOwnersAllowlist(owners []string) *OwnersAllowlist {
return &OwnersAllowlist{owners: utils.SliceToBoolMap(owners)}
}
type OwnersAllowlist struct {
owners map[string]bool
}
func (o *OwnersAllowlist) IsAllowed(repo *model.Repo) bool {
return len(o.owners) < 1 || o.owners[repo.Owner]
}