示例#1
0
文件: resource.py 项目: zwunix/SFO
class SfoServerResourceAPI(Resource):

    resource = SfoServerResource
    method_decorators = [permission_required(resource)]

    def get(self, id):
        try:
            resp, status = get_resource_info(id)
            return resp, status
        except Exception, ex:
            status = 500
            message = str(ex)
            return {'status': status, "message": message}, status
示例#2
0
class SfoServerPermissionListAPI(Resource):

    resource = SfoServerPermission

    method_decorators = [permission_required(resource), login_required]

    def get(self):
        try:
            resp, status = get_permission_list()
            return resp, status
        except Exception, ex:
            status = 500
            message = str(ex)
            return {'status': status, "message": message}, status
示例#3
0
文件: userlist.py 项目: zwunix/SFO
class UserListAPI(Resource):

    resource = SfoServerUser

    method_decorators = [permission_required(resource), login_required]

    @marshal_with(user_info_resource_fields)
    def get(self):
        try:
            resp, status = get_user_info()
            return resp, status
        except Exception, ex:
            status = 500
            message = str(ex)
            return {'status': status, "message": message}, status
示例#4
0
文件: role.py 项目: zwunix/SFO
class SfoServerRoleAPI(Resource):

    resource = SfoServerRole

    method_decorators = [permission_required(resource), login_required]

    @marshal_with(role_resource_fields)
    def get(self, role_name):
        try:
            resp, status = get_role_info(role_name)
            return resp, status
        except Exception, ex:
            status = 500
            message = str(ex)
            return {'status': status, "message": message}, status
示例#5
0
class SfoServerConfigAPI(Resource):

    resource = SfoCofigure

    method_decorators = [permission_required(resource), login_required]

    @marshal_with(config_field)
    def get(self):
        try:
            query = request.args.get('query', '')
            page = request.args.get('page', 1)
            limit = request.args.get('limit', 10)
            resp, status = get_config(page, query, limit)
            return resp, status
        except Exception, ex:
            status = 500
            message = str(ex)
            return {'status': status, "message": message}, status