mirror of
https://github.com/rancher/steve.git
synced 2025-07-31 22:36:52 +00:00
25 lines
476 B
Go
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
|
||
|
}
|