示例#1
0
 def get(self, name):
   session_id = get_session_id(session, request)
   dao = CountermeasureDAO(session_id)
   spNames = dao.countermeasure_patterns(name)
   dao.close()
   resp = make_response(json_serialize(spNames, session_id=session_id), OK)
   resp.contenttype = 'application/json'
   return resp
 def get(self, name):
     session_id = get_session_id(session, request)
     dao = CountermeasureDAO(session_id)
     spNames = dao.countermeasure_patterns(name)
     dao.close()
     resp = make_response(json_serialize(spNames, session_id=session_id),
                          OK)
     resp.contenttype = 'application/json'
     return resp
示例#3
0
 def get(self, environment):
   session_id = get_session_id(session, request)
   reqList = request.args.getlist('requirement')
   dao = CountermeasureDAO(session_id)
   targets = dao.get_countermeasure_targets(reqList,environment)
   dao.close()
   resp = make_response(json_serialize(targets, session_id=session_id), OK)
   resp.contenttype = 'application/json'
   return resp
示例#4
0
  def get(self, name):
    session_id = get_session_id(session, request)

    dao = CountermeasureDAO(session_id)
    countermeasure = dao.get_countermeasure_by_name(name=name)
    dao.close()

    resp = make_response(json_serialize(countermeasure, session_id=session_id), httplib.OK)
    resp.headers['Content-type'] = 'application/json'
    return resp
 def get(self, environment):
     session_id = get_session_id(session, request)
     reqList = request.args.getlist('requirement')
     dao = CountermeasureDAO(session_id)
     targets = dao.get_countermeasure_targets(reqList, environment)
     dao.close()
     resp = make_response(json_serialize(targets, session_id=session_id),
                          OK)
     resp.contenttype = 'application/json'
     return resp
示例#6
0
  def get(self):
    session_id = get_session_id(session, request)
    constraint_id = request.args.get('constraint_id', -1)

    dao = CountermeasureDAO(session_id)
    countermeasures = dao.get_countermeasures(constraint_id=constraint_id)
    dao.close()

    resp = make_response(json_serialize(countermeasures, session_id=session_id), httplib.OK)
    resp.contenttype = 'application/json'
    return resp
示例#7
0
  def delete(self, name, security_pattern_name):
    session_id = get_session_id(session, request)

    dao = CountermeasureDAO(session_id)
    dao.remove_situated_pattern(name,security_pattern_name)
    dao.close()

    resp_dict = {'message': 'Situated pattern removed'}
    resp = make_response(json_serialize(resp_dict), OK)
    resp.headers['Content-type'] = 'application/json'
    return resp
示例#8
0
  def delete(self, name):
    session_id = get_session_id(session, request)

    dao = CountermeasureDAO(session_id)
    dao.delete_countermeasure(name=name)
    dao.close()

    resp_dict = {'message': 'Countermeasure successfully deleted'}
    resp = make_response(json_serialize(resp_dict), httplib.OK)
    resp.headers['Content-type'] = 'application/json'
    return resp
示例#9
0
  def post(self, name, template_asset_name):
    session_id = get_session_id(session, request)

    dao = CountermeasureDAO(session_id)
    dao.generate_asset_from_template(name,template_asset_name)
    dao.close()

    resp_dict = {'message': 'Asset successfully generated'}
    resp = make_response(json_serialize(resp_dict), OK)
    resp.headers['Content-type'] = 'application/json'
    return resp
示例#10
0
    def get(self, name):
        session_id = get_session_id(session, request)

        dao = CountermeasureDAO(session_id)
        countermeasure = dao.get_countermeasure_by_name(name=name)
        dao.close()

        resp = make_response(
            json_serialize(countermeasure, session_id=session_id), OK)
        resp.headers['Content-type'] = 'application/json'
        return resp
示例#11
0
  def post(self):
    session_id = get_session_id(session, request)

    dao = CountermeasureDAO(session_id)
    new_countermeasure = dao.from_json(request)
    countermeasure_id = dao.add_countermeasure(new_countermeasure)
    dao.close()

    resp_dict = {'message': 'Countermeasure successfully added', 'countermeasure_id': countermeasure_id}
    resp = make_response(json_serialize(resp_dict), httplib.OK)
    resp.contenttype = 'application/json'
    return resp
示例#12
0
    def get(self):
        session_id = get_session_id(session, request)
        constraint_id = request.args.get('constraint_id', -1)

        dao = CountermeasureDAO(session_id)
        countermeasures = dao.get_countermeasures(constraint_id=constraint_id)
        dao.close()

        resp = make_response(
            json_serialize(countermeasures, session_id=session_id), OK)
        resp.contenttype = 'application/json'
        return resp
示例#13
0
    def put(self, name):
        session_id = get_session_id(session, request)

        dao = CountermeasureDAO(session_id)
        req = dao.from_json(request)
        dao.update_countermeasure(req, name=name)
        dao.close()

        resp_dict = {'message': 'Countermeasure successfully updated'}
        resp = make_response(json_serialize(resp_dict), OK)
        resp.headers['Content-type'] = 'application/json'
        return resp
示例#14
0
    def post(self):
        session_id = get_session_id(session, request)

        dao = CountermeasureDAO(session_id)
        new_countermeasure = dao.from_json(request)
        dao.add_countermeasure(new_countermeasure)
        dao.close()

        resp_dict = {'message': 'Countermeasure successfully added'}
        resp = make_response(json_serialize(resp_dict), OK)
        resp.contenttype = 'application/json'
        return resp
示例#15
0
    def delete(self, name):
        session_id = get_session_id(session, request)

        dao = CountermeasureDAO(session_id)
        dao.delete_countermeasure(name=name)
        dao.close()

        resp_dict = {'message': 'Countermeasure successfully deleted'}
        resp = make_response(json_serialize(resp_dict), httplib.OK)
        resp.headers['Content-type'] = 'application/json'
        return resp
示例#16
0
    def post(self, name, template_asset_name):
        session_id = get_session_id(session, request)

        dao = CountermeasureDAO(session_id)
        dao.generate_asset_from_template(name, template_asset_name)
        dao.close()

        resp_dict = {'message': 'Asset successfully generated'}
        resp = make_response(json_serialize(resp_dict), OK)
        resp.headers['Content-type'] = 'application/json'
        return resp
示例#17
0
    def delete(self, name, security_pattern_name):
        session_id = get_session_id(session, request)

        dao = CountermeasureDAO(session_id)
        dao.remove_situated_pattern(name, security_pattern_name)
        dao.close()

        resp_dict = {'message': 'Situated pattern removed'}
        resp = make_response(json_serialize(resp_dict), OK)
        resp.headers['Content-type'] = 'application/json'
        return resp
示例#18
0
  def put(self, name):
    session_id = get_session_id(session, request)

    dao = CountermeasureDAO(session_id)
    req = dao.from_json(request)
    dao.update_countermeasure(req, name=name)
    dao.close()

    resp_dict = {'message': 'Countermeasure successfully updated'}
    resp = make_response(json_serialize(resp_dict), OK)
    resp.headers['Content-type'] = 'application/json'
    return resp