models
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user