mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-12 02:25:27 +00:00
adb2c82790
https://go.dev/doc/modules/release-workflow#breaking Fixes https://github.com/woodpecker-ci/woodpecker/issues/2913 fixes #2654 ``` runephilosof@fedora:~/code/platform-woodpecker/woodpecker-repo-configurator (master)$ go get go.woodpecker-ci.org/woodpecker@v2.0.0 go: go.woodpecker-ci.org/woodpecker@v2.0.0: invalid version: module contains a go.mod file, so module path must match major version ("go.woodpecker-ci.org/woodpecker/v2") ``` --------- Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
18 lines
363 B
Go
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]
|
|
}
|