Beispiel #1
0
 def get(self, name):
     session_id = get_session_id(session, request)
     dao = RoleDAO(session_id)
     props = dao.get_role_props(name)
     dao.close()
     resp = make_response(json_serialize(props, session_id=session_id), OK)
     resp.contenttype = 'application/json'
     return resp
Beispiel #2
0
 def get(self, name):
   session_id = get_session_id(session, request)
   dao = RoleDAO(session_id)
   props = dao.get_role_props(name)
   dao.close()
   resp = make_response(json_serialize(props, session_id=session_id), OK)
   resp.contenttype = 'application/json'
   return resp
Beispiel #3
0
 def get(self, name):
     session_id = get_session_id(session, request)
     dao = RoleDAO(session_id)
     found_role = dao.get_role_by_name(name)
     dao.close()
     resp = make_response(json_serialize(found_role, session_id=session_id))
     resp.headers['Content-Type'] = "application/json"
     return resp
Beispiel #4
0
 def get(self, name):
   session_id = get_session_id(session, request)
   dao = RoleDAO(session_id)
   found_role = dao.get_role_by_name(name)
   dao.close()
   resp = make_response(json_serialize(found_role, session_id=session_id))
   resp.headers['Content-Type'] = "application/json"
   return resp
Beispiel #5
0
 def get(self):
     session_id = get_session_id(session, request)
     constraint_id = request.args.get('constraint_id', -1)
     dao = RoleDAO(session_id)
     roles = dao.get_roles(constraint_id)
     dao.close()
     resp = make_response(json_serialize(roles, session_id=session_id))
     resp.contenttype = "application/json"
     return resp
Beispiel #6
0
 def delete(self, name):
   session_id = get_session_id(session, request)
   dao = RoleDAO(session_id)
   dao.delete_role(name=name)
   dao.close()
   resp_dict = {'message': 'Role successfully deleted'}
   resp = make_response(json_serialize(resp_dict, session_id=session_id), OK)
   resp.contenttype = 'application/json'
   return resp
Beispiel #7
0
 def get(self):
   session_id = get_session_id(session, request)
   constraint_id = request.args.get('constraint_id', -1)
   dao = RoleDAO(session_id)
   roles = dao.get_roles(constraint_id)
   dao.close()
   resp = make_response(json_serialize(roles, session_id=session_id))
   resp.contenttype = "application/json"
   return resp
Beispiel #8
0
 def delete(self, name):
     session_id = get_session_id(session, request)
     dao = RoleDAO(session_id)
     dao.delete_role(name=name)
     dao.close()
     resp_dict = {'message': 'Role successfully deleted'}
     resp = make_response(json_serialize(resp_dict, session_id=session_id),
                          OK)
     resp.contenttype = 'application/json'
     return resp
Beispiel #9
0
 def put(self, name):
   session_id = get_session_id(session, request)
   dao = RoleDAO(session_id)
   upd_role = dao.from_json(request)
   dao.update_role(upd_role, name=name)
   dao.close()
   resp_dict = {'message': 'Update successful'}
   resp = make_response(json_serialize(resp_dict, session_id=session_id), OK)
   resp.contenttype = 'application/json'
   return resp
Beispiel #10
0
 def post(self):
   session_id = get_session_id(session, request)
   dao = RoleDAO(session_id)
   new_role = dao.from_json(request)
   dao.add_role(new_role)
   dao.close()
   resp_dict = {'message': 'Add successful'}
   resp = make_response(json_serialize(resp_dict, session_id=session_id), OK)
   resp.contenttype = 'application/json'
   return resp
Beispiel #11
0
 def put(self, name):
     session_id = get_session_id(session, request)
     dao = RoleDAO(session_id)
     upd_role = dao.from_json(request)
     dao.update_role(upd_role, name=name)
     dao.close()
     resp_dict = {'message': 'Update successful'}
     resp = make_response(json_serialize(resp_dict, session_id=session_id),
                          OK)
     resp.contenttype = 'application/json'
     return resp
Beispiel #12
0
 def post(self):
     session_id = get_session_id(session, request)
     dao = RoleDAO(session_id)
     new_role = dao.from_json(request)
     dao.add_role(new_role)
     dao.close()
     resp_dict = {'message': 'Add successful'}
     resp = make_response(json_serialize(resp_dict, session_id=session_id),
                          OK)
     resp.contenttype = 'application/json'
     return resp
    def post(self):
        session_id = get_session_id(session, request)

        dao = RoleDAO(session_id)
        new_role = dao.from_json(request)
        role_id = dao.add_role(new_role)
        dao.close()

        resp_dict = {'role_id': role_id}
        resp = make_response(json_serialize(resp_dict, session_id=session_id), httplib.OK)
        resp.contenttype = 'application/json'
        return resp
Beispiel #14
0
    def post(self):
        session_id = get_session_id(session, request)

        dao = RoleDAO(session_id)
        new_role = dao.from_json(request)
        role_id = dao.add_role(new_role)
        dao.close()

        resp_dict = {'role_id': role_id}
        resp = make_response(json_serialize(resp_dict, session_id=session_id),
                             httplib.OK)
        resp.contenttype = 'application/json'
        return resp