1
0
mirror of https://github.com/rancher/norman.git synced 2025-07-04 02:56:42 +00:00
norman/authorization/all.go

40 lines
1.3 KiB
Go
Raw Normal View History

2017-11-11 04:44:02 +00:00
package authorization
import (
"net/http"
"github.com/rancher/norman/types"
2017-12-18 20:56:50 +00:00
"github.com/rancher/norman/types/slice"
2017-11-11 04:44:02 +00:00
)
type AllAccess struct {
}
2017-12-18 20:56:50 +00:00
func (*AllAccess) CanCreate(apiContext *types.APIContext, schema *types.Schema) bool {
return slice.ContainsString(schema.CollectionMethods, http.MethodPost)
2017-11-11 04:44:02 +00:00
}
func (*AllAccess) CanGet(apiContext *types.APIContext, schema *types.Schema) bool {
return slice.ContainsString(schema.ResourceMethods, http.MethodGet)
}
2017-12-18 20:56:50 +00:00
func (*AllAccess) CanList(apiContext *types.APIContext, schema *types.Schema) bool {
return slice.ContainsString(schema.CollectionMethods, http.MethodGet)
}
func (*AllAccess) CanUpdate(apiContext *types.APIContext, obj map[string]interface{}, schema *types.Schema) bool {
2017-12-18 20:56:50 +00:00
return slice.ContainsString(schema.ResourceMethods, http.MethodPut)
}
func (*AllAccess) CanDelete(apiContext *types.APIContext, obj map[string]interface{}, schema *types.Schema) bool {
2017-12-18 20:56:50 +00:00
return slice.ContainsString(schema.ResourceMethods, http.MethodDelete)
}
2018-03-03 06:09:47 +00:00
func (*AllAccess) Filter(apiContext *types.APIContext, schema *types.Schema, obj map[string]interface{}, context map[string]string) map[string]interface{} {
2017-12-18 20:56:50 +00:00
return obj
}
2018-03-03 06:09:47 +00:00
func (*AllAccess) FilterList(apiContext *types.APIContext, schema *types.Schema, obj []map[string]interface{}, context map[string]string) []map[string]interface{} {
2017-12-18 20:56:50 +00:00
return obj
2017-11-11 04:44:02 +00:00
}