CanUpdate

This commit is contained in:
mr
2026-03-21 15:08:01 +01:00
parent 88d2e52628
commit b82b955045

View File

@@ -100,10 +100,13 @@ func ModelGenericUpdateOne(change map[string]interface{}, id string, a Accessor)
obj := a.NewObj()
b, _ := json.Marshal(r)
json.Unmarshal(b, obj)
ok, r := r.CanUpdate(obj)
if !a.GetRequest().Admin {
var ok bool
ok, r = r.CanUpdate(obj)
if !ok {
return nil, nil, 403, errors.New("you are not allowed to update :" + a.GetType().String())
}
}
r.UpToDate(a.GetUser(), a.GetPeerID(), false)
if a.GetPeerID() == r.GetCreatorID() {
r.Unsign()