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
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
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
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
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