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
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2018-01-17 01:03:35 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2018-01-17 01:03:35 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*AllAccess) Filter(apiContext *types.APIContext, obj map[string]interface{}, context map[string]string) map[string]interface{} {
|
|
|
|
return obj
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*AllAccess) FilterList(apiContext *types.APIContext, obj []map[string]interface{}, context map[string]string) []map[string]interface{} {
|
|
|
|
return obj
|
2017-11-11 04:44:02 +00:00
|
|
|
}
|