mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-21 22:58:32 +00:00
81b74025d4
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
18 lines
363 B
Go
18 lines
363 B
Go
package permissions
|
|
|
|
import (
|
|
"go.woodpecker-ci.org/woodpecker/v3/server/model"
|
|
"go.woodpecker-ci.org/woodpecker/v3/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]
|
|
}
|