1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-15 23:08:26 +00:00
Files
steve/pkg/accesscontrol/access_control.go
Darren Shepherd c0299c1506 Initial commit
2019-08-04 10:41:32 -07:00

25 lines
476 B
Go

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