1
0
mirror of https://github.com/rancher/steve.git synced 2025-04-27 02:51:10 +00:00
steve/pkg/accesscontrol/access_control.go
Darren Shepherd 8b42d0aff8 Refactor
2020-01-30 22:37:59 -07:00

25 lines
489 B
Go

package accesscontrol
import (
"fmt"
"github.com/rancher/steve/pkg/schemaserver/server"
"github.com/rancher/steve/pkg/schemaserver/types"
)
type AccessControl struct {
server.AllAccess
}
func NewAccessControl() *AccessControl {
return &AccessControl{}
}
func (a *AccessControl) CanWatch(apiOp *types.APIRequest, schema *types.APISchema) error {
access := GetAccessListMap(schema)
if !access.Grants("watch", "*", "*") {
return fmt.Errorf("watch not allowed")
}
return nil
}