def delete(self, role_id): user = g.user_info["username"] db = DB() status, result = db.delete_by_id("role", role_id) db.close_mysql() if status is not True: logger.error("Delete role error: %s" % result) return {"status": False, "message": result}, 500 if result is 0: return { "status": False, "message": "%s does not exist" % role_id }, 404 audit_log(user, role_id, "", "role", "delete") info = update_user_privilege("role", role_id) if info["status"] is False: return {"status": False, "message": info["message"]}, 500 return {"status": True, "message": ""}, 200
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