1
0
mirror of https://github.com/rancher/steve.git synced 2025-08-18 22:28:35 +00:00
steve/pkg/accesscontrol/access_control.go
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
}