1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-08 18:59:58 +00:00

Shuffle around code and use rancher/apiserver

This commit is contained in:
Darren Shepherd
2020-06-11 21:50:59 -07:00
parent 2543926f99
commit d1a7dbb0b9
86 changed files with 105 additions and 3224 deletions

View File

@@ -1,10 +1,9 @@
package accesscontrol
import (
"fmt"
"github.com/rancher/steve/pkg/schemaserver/server"
"github.com/rancher/steve/pkg/schemaserver/types"
"github.com/rancher/apiserver/pkg/server"
"github.com/rancher/apiserver/pkg/types"
"github.com/rancher/steve/pkg/attributes"
)
type AccessControl struct {
@@ -16,9 +15,11 @@ func NewAccessControl() *AccessControl {
}
func (a *AccessControl) CanWatch(apiOp *types.APIRequest, schema *types.APISchema) error {
access := GetAccessListMap(schema)
if _, ok := access["watch"]; ok {
return nil
if attributes.GVK(schema).Kind != "" {
access := GetAccessListMap(schema)
if _, ok := access["watch"]; ok {
return nil
}
}
return fmt.Errorf("watch not allowed")
return a.SchemaBasedAccess.CanWatch(apiOp, schema)
}