def put(self, name): session_id = get_session_id(session, request) environment_name = request.args.get('environment', '') dao = AttackerDAO(session_id) attacker_motivation = dao.type_from_json(request) dao.update_attacker_motivation(attacker_motivation, name=name, environment_name=environment_name) dao.close() resp_dict = {'message': 'Attacker motivation successfully updated'} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def put(self, name): session_id = get_session_id(session, request) environment_name = request.args.get('environment', '') dao = AttackerDAO(session_id) attacker_motivation = dao.type_from_json(request) dao.update_attacker_motivation(attacker_motivation, name=name, environment_name=environment_name) dao.close() resp_dict = {'message': 'Attacker motivation successfully updated'} resp = make_response(json_serialize(resp_dict), OK) resp.headers['Content-type'] = 'application/json' return resp
def post(self): session_id = get_session_id(session, request) environment_name = request.args.get('environment', '') dao = AttackerDAO(session_id) new_value_type = dao.type_from_json(request) attacker_motivation_id = dao.add_attacker_motivation(new_value_type, environment_name=environment_name) dao.close() resp_dict = {'message': 'Attacker motivation successfully added', 'attacker_motivation_id': attacker_motivation_id} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.contenttype = 'application/json' return resp
def post(self): session_id = get_session_id(session, request) environment_name = request.args.get('environment', '') dao = AttackerDAO(session_id) new_value_type = dao.type_from_json(request) attacker_motivation_id = dao.add_attacker_motivation(new_value_type, environment_name=environment_name) dao.close() resp_dict = {'message': 'Attacker motivation successfully added', 'attacker_motivation_id': attacker_motivation_id} resp = make_response(json_serialize(resp_dict), OK) resp.contenttype = 'application/json' return resp