1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-12 13:31:57 +00:00
This commit is contained in:
Darren Shepherd
2020-01-30 22:37:59 -07:00
parent 19c6732de0
commit 8b42d0aff8
71 changed files with 4024 additions and 507 deletions

View File

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