not found del
This commit is contained in:
@@ -70,6 +70,12 @@ func GenericStoreOne(data DBObject, a Accessor) (DBObject, int, error) {
|
||||
// GenericLoadOne loads one object from the database (generic)
|
||||
func GenericDeleteOne(id string, a Accessor) (DBObject, int, error) {
|
||||
res, code, err := a.LoadOne(id)
|
||||
if err != nil {
|
||||
return res, code, err
|
||||
}
|
||||
if res == nil {
|
||||
return res, code, errors.New("not found")
|
||||
}
|
||||
if !res.CanDelete() {
|
||||
return nil, 403, errors.New("you are not allowed to delete :" + a.GetType().String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user