woodpecker/server/services/permissions/admins.go
2024-02-11 18:42:33 +01:00

18 lines
363 B
Go

package permissions
import (
"go.woodpecker-ci.org/woodpecker/v2/server/model"
"go.woodpecker-ci.org/woodpecker/v2/shared/utils"
)
func NewAdmins(admins []string) *Admins {
return &Admins{admins: utils.SliceToBoolMap(admins)}
}
type Admins struct {
admins map[string]bool
}
func (a *Admins) IsAdmin(user *model.User) bool {
return a.admins[user.Login]
}