Allow override AllowCreateOnUpdate with new argument to Update

This commit is contained in:
jennybuckley
2018-06-28 14:24:51 -07:00
parent 0d9c432542
commit d10e08fc89
64 changed files with 161 additions and 160 deletions

View File

@@ -83,9 +83,9 @@ func (s *Storage) Create(ctx context.Context, obj runtime.Object, createValidati
return s.StandardStorage.Create(ctx, obj, createValidation, includeUninitialized)
}
func (s *Storage) Update(ctx context.Context, name string, obj rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (runtime.Object, bool, error) {
func (s *Storage) Update(ctx context.Context, name string, obj rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool) (runtime.Object, bool, error) {
if rbacregistry.EscalationAllowed(ctx) {
return s.StandardStorage.Update(ctx, name, obj, createValidation, updateValidation)
return s.StandardStorage.Update(ctx, name, obj, createValidation, updateValidation, forceAllowCreate)
}
nonEscalatingInfo := rest.WrapUpdatedObjectInfo(obj, func(ctx context.Context, obj runtime.Object, oldObj runtime.Object) (runtime.Object, error) {
@@ -124,5 +124,5 @@ func (s *Storage) Update(ctx context.Context, name string, obj rest.UpdatedObjec
return obj, nil
})
return s.StandardStorage.Update(ctx, name, nonEscalatingInfo, createValidation, updateValidation)
return s.StandardStorage.Update(ctx, name, nonEscalatingInfo, createValidation, updateValidation, forceAllowCreate)
}