mirror of
https://github.com/rancher/norman.git
synced 2025-09-05 17:20:20 +00:00
Ensure one can read the object with an action before running actionhandler
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/rancher/norman/api/access"
|
||||||
"github.com/rancher/norman/api/builtin"
|
"github.com/rancher/norman/api/builtin"
|
||||||
"github.com/rancher/norman/api/handler"
|
"github.com/rancher/norman/api/handler"
|
||||||
"github.com/rancher/norman/api/writer"
|
"github.com/rancher/norman/api/writer"
|
||||||
@@ -220,8 +221,11 @@ func (s *Server) handle(rw http.ResponseWriter, req *http.Request) (*types.APICo
|
|||||||
return apiRequest, nil
|
return apiRequest, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleAction(action *types.Action, request *types.APIContext) error {
|
func handleAction(action *types.Action, context *types.APIContext) error {
|
||||||
return request.Schema.ActionHandler(request.Action, action, request)
|
if err := access.ByID(context, context.Version, context.Type, context.ID, nil); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return context.Schema.ActionHandler(context.Action, action, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleError(apiRequest *types.APIContext, err error) {
|
func (s *Server) handleError(apiRequest *types.APIContext, err error) {
|
||||||
|
Reference in New Issue
Block a user