woodpecker/server/plugins/permissions/admin.go
qwerty287 fd77b2e9d7
Fix repo owner filter (#2808)
and move to server config instead of middleware

cc @xoxys 

closes #2784
2023-11-12 14:39:41 +01:00

18 lines
357 B
Go

package permissions
import (
"go.woodpecker-ci.org/woodpecker/server/model"
"go.woodpecker-ci.org/woodpecker/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]
}