Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 8
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
Esempio n. 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
Esempio n. 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
Esempio n. 11
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
Esempio n. 12
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
Esempio n. 13
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
Esempio n. 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