def parse_item_authorize_input_info(request): op_info = parse_item_options_base(request) http_body = op_info.http_body privilege_type = request_util.item_check(http_body, "type") target_user_id = request_util.item_check(http_body, "user_id") op_info.set_privilege_type(privilege_type) op_info.set_int_attr("target_user_id", target_user_id) return op_info
def parse_org_create_input_info(request): org_op_info = request_util.parse_request(request) http_body = org_op_info.http_body org_name = request_util.item_check(http_body, "name") is_private = request_util.item_check(http_body, "private") org_op_info.set_resource_name(org_name) org_op_info.set_visibility(is_private) return org_op_info
def parse_project_create_input_info(request): project_op_info = request_util.parse_request(request) http_body = project_op_info.http_body parent_id = request_util.item_check(http_body, "parent_id") project_name = request_util.item_check(http_body, "name") is_private = request_util.item_check(http_body, "private") project_op_info.set_parent_id(parent_id) project_op_info.set_resource_name(project_name) project_op_info.set_visibility(is_private) return project_op_info
def parse_item_modify_request(request): op_info = parse_item_options_base(request) http_body = op_info.http_body item_data = request_util.item_check(http_body, "content") item_visibility = request_util.item_check(http_body, "private") item_type = http_body.get("type", None) op_info.item_data = item_data op_info.set_visibility(item_visibility) op_info.set_item_type(item_type) return op_info
def parse_user_search_op_info(request): op_info = request_util.parse_request(request) search_name = request_util.item_check(request.args, 'q') op_info.search_name = search_name return op_info
def parse_resource_search_info(request): op_info = request_util.parse_request(request) resource_name = request_util.item_check(request.args, "q") op_info.resource_name = resource_name return op_info
def parse_item_create_argument(request): op_info = parse_item_options_base(request) http_body = op_info.http_body item_name = request_util.item_check(http_body, "name") item_type = request_util.item_check(http_body, "type") parent_id = request_util.item_check(http_body, "parent_id") is_private = request_util.item_check(http_body, "private") item_data = http_body.get("content", None) op_info.item_data = item_data op_info.set_resource_name(item_name) op_info.set_parent_id(parent_id) op_info.set_visibility(is_private) op_info.set_item_type(item_type) return op_info
def parse_project_modification_info(request): op_info = request_util.parse_request(request) http_body = op_info.http_body private = request_util.item_check(http_body, "private") lower_private = str(private).lower() if lower_private == "true": op_info.visibility = Resource.Visibility.PRIVATE elif lower_private == "false": op_info.visibility = Resource.Visibility.PUBLIC else: raise GulDanException().with_code(400).with_message( u"非法的可见性类型:{}".format(http_body) ) return op_info
def parse_grey_item_creation_arguments(op_info): item_id = item_check(op_info.http_body, "item_id") op_info.set_int_attr("item_id", item_id) return op_info
def parse_user_register_input_info(request): http_body = request_util.retrieve_request_body(request) username = request_util.item_check(http_body, "name") password = request_util.item_check(http_body, "password") return username, password