This commit is contained in:
mr
2026-03-04 13:43:14 +01:00
parent 66ee4156e2
commit 5d18512f67
2 changed files with 6 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package utils
import (
"encoding/json"
"errors"
"os"
@@ -91,7 +92,10 @@ func ModelGenericUpdateOne(change map[string]interface{}, id string, a Accessor)
if err != nil {
return nil, c, err
}
ok, r := r.CanUpdate(r)
obj := &AbstractObject{}
b, _ := json.Marshal(r)
json.Unmarshal(b, obj)
ok, r := r.CanUpdate(obj)
if !ok {
return nil, 403, errors.New("you are not allowed to update :" + a.GetType().String())
}