CanUpdate
This commit is contained in:
@@ -100,9 +100,12 @@ 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 !ok {
|
||||
return nil, nil, 403, errors.New("you are not allowed to update :" + a.GetType().String())
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user