mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-12 03:26:30 +00:00
19 lines
357 B
Go
19 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]
|
||
|
}
|