resource as draft for update

This commit is contained in:
mr
2026-03-04 13:31:05 +01:00
parent b47b51126a
commit f1eaf497aa
3 changed files with 6 additions and 10 deletions

View File

@@ -93,7 +93,7 @@ func ModelGenericUpdateOne(change map[string]interface{}, id string, a Accessor)
}
ok, r := r.CanUpdate(r)
if !ok {
return nil, 403, errors.New("you are not allowed to delete :" + a.GetType().String())
return 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() {
@@ -114,6 +114,9 @@ func ModelGenericUpdateOne(change map[string]interface{}, id string, a Accessor)
// GenericLoadOne loads one object from the database (generic)
// json expected in entry is a flatted object no need to respect the inheritance hierarchy
func GenericUpdateOne(change map[string]interface{}, id string, a Accessor, new DBObject) (DBObject, int, error) {
if change["is_draft"] == nil {
change["is_draft"] = false
}
loaded, c, err := ModelGenericUpdateOne(change, id, a)
if err != nil {
return nil, c, err