CanUpdate
This commit is contained in:
@@ -100,9 +100,12 @@ func ModelGenericUpdateOne(change map[string]interface{}, id string, a Accessor)
|
|||||||
obj := a.NewObj()
|
obj := a.NewObj()
|
||||||
b, _ := json.Marshal(r)
|
b, _ := json.Marshal(r)
|
||||||
json.Unmarshal(b, obj)
|
json.Unmarshal(b, obj)
|
||||||
ok, r := r.CanUpdate(obj)
|
if !a.GetRequest().Admin {
|
||||||
if !ok {
|
var ok bool
|
||||||
return nil, nil, 403, errors.New("you are not allowed to update :" + a.GetType().String())
|
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)
|
r.UpToDate(a.GetUser(), a.GetPeerID(), false)
|
||||||
if a.GetPeerID() == r.GetCreatorID() {
|
if a.GetPeerID() == r.GetCreatorID() {
|
||||||
|
|||||||
Reference in New Issue
Block a user