parent
548f65eeb7
commit
9b36644a31
4 changed files with 17 additions and 0 deletions
|
@ -204,6 +204,10 @@ func (c CharacteristicService) Delete(id int64, genus string, claims *types.Clai
|
|||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if !characteristic.CanEdit {
|
||||
return newJSONError(errors.ErrCharacteristicNotDeleted, http.StatusForbidden)
|
||||
}
|
||||
|
||||
if err := models.Delete(characteristic); err != nil {
|
||||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
|
|
|
@ -121,6 +121,11 @@ func (m MeasurementService) Delete(id int64, genus string, claims *types.Claims)
|
|||
if err != nil {
|
||||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if !measurement.CanEdit {
|
||||
return newJSONError(errors.ErrMeasurementNotDeleted, http.StatusForbidden)
|
||||
}
|
||||
|
||||
if err := models.Delete(measurement.MeasurementBase); err != nil {
|
||||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
|
|
|
@ -164,6 +164,10 @@ func (s SpeciesService) Delete(id int64, genus string, claims *types.Claims) *ty
|
|||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if !species.CanEdit {
|
||||
return newJSONError(errors.ErrSpeciesNotDeleted, http.StatusForbidden)
|
||||
}
|
||||
|
||||
if err := models.Delete(species.SpeciesBase); err != nil {
|
||||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
|
|
|
@ -227,6 +227,10 @@ func (s StrainService) Delete(id int64, genus string, claims *types.Claims) *typ
|
|||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if !strain.CanEdit {
|
||||
return newJSONError(errors.ErrStrainNotDeleted, http.StatusForbidden)
|
||||
}
|
||||
|
||||
if err := models.Delete(strain); err != nil {
|
||||
return newJSONError(err, http.StatusInternalServerError)
|
||||
}
|
||||
|
|
Reference in a new issue