1
0
mirror of https://github.com/rancher/steve.git synced 2025-06-01 19:36:00 +00:00
steve/pkg/accesscontrol/access_control.go
2020-02-03 14:28:25 -07:00

25 lines
497 B
Go

package accesscontrol
import (
"fmt"
"github.com/rancher/steve/pkg/schemaserver/server"
"github.com/rancher/steve/pkg/schemaserver/types"
)
type AccessControl struct {
server.SchemaBasedAccess
}
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
}