Fix permission check when editing existing resource
@@ -77,6 +77,9 @@ func (processor *processor) decode() (errs []error) {
newRecord := true
scope := &gorm.Scope{Value: processor.Result}
if primaryField := scope.PrimaryField(); primaryField != nil {
+ if !primaryField.IsBlank {
+ newRecord = false
+ } else {
for _, metaValue := range processor.MetaValues.Values {
if metaValue.Meta != nil && metaValue.Meta.GetFieldName() == primaryField.Name {
if v := utils.ToString(metaValue.Value); v != "" && v != "0" {
@@ -85,6 +88,7 @@ func (processor *processor) decode() (errs []error) {
}
}
}
+ }
for _, metaValue := range processor.MetaValues.Values {
meta := metaValue.Meta
