def delete(self, groups_id): user = g.user_info["username"] db = DB() status, result = db.delete_by_id("groups", groups_id) db.close_mysql() if status is not True: logger.error("Delete groups error: %s" % result) return {"status": False, "message": result}, 500 if result is 0: return {"status": False, "message": "%s does not exist" % groups_id}, 404 audit_log(user, groups_id, "", "groups", "delete") info = update_user_privilege("groups", groups_id) if info["status"] is False: return {"status": False, "message": info["message"]}, 500 return {"status": True, "message": ""}, 204
def delete(self, product_id): user = g.user_info["username"] db = DB() status, result = db.delete_by_id("product", product_id) db.close_mysql() if status is not True: logger.error("Delete product error: %s" % result) return {"status": False, "message": result}, 500 if result is 0: return { "status": False, "message": "%s does not exist" % product_id }, 404 audit_log(user, product_id, product_id, "product", "delete") info = update_user_privilege("product", product_id) if info["status"] is False: return {"status": False, "message": info["message"]}, 500 # 更新Rsync配置 rsync_config() return {"status": True, "message": ""}, 200