flyrain commented on code in PR #2473: URL: https://github.com/apache/polaris/pull/2473#discussion_r2311330551
########## polaris-core/src/main/java/org/apache/polaris/core/storage/LocationRestrictions.java: ########## @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.polaris.core.storage; + +import jakarta.annotation.Nonnull; +import java.util.List; +import java.util.Set; +import org.apache.iceberg.catalog.TableIdentifier; +import org.apache.iceberg.exceptions.ForbiddenException; +import org.apache.polaris.core.config.RealmConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** Defines storage location access restrictions for Polaris entities within a specific context. */ +public class LocationRestrictions { + private static final Logger LOGGER = LoggerFactory.getLogger(LocationRestrictions.class); + + /** + * The complete set of storage locations that are permitted for access. + * + * <p>This list contains all storage URIs that entities can read from or write to, including both + * catalog-level allowed locations and any additional user-specified locations when unstructured + * table access is enabled. + * + * <p>All locations in this list have been validated to conform to the storage type's URI scheme + * requirements during construction. + */ + private final List<String> allowedLocations; + + /** + * The parent location for structured table enforcement. + * + * <p>When non-null, this location represents the root under which all new tables must be created, + * enforcing a structured hierarchy. When null, table creation is allowed anywhere within the + * {@code allowedLocations}. + */ + private final String parentLocation; + + public LocationRestrictions( + @Nonnull PolarisStorageConfigurationInfo storageConfigurationInfo, + List<String> allowedLocations, Review Comment: Fixed ########## polaris-core/src/main/java/org/apache/polaris/core/storage/PolarisStorageConfigurationInfo.java: ########## @@ -160,7 +161,7 @@ public static Optional<PolarisStorageConfigurationInfo> forEntityPath( Set<String> locations = StorageUtil.getLocationsAllowedToBeAccessed( null, entityPathReversed.get(0).getPropertiesAsMap()); - return new StorageConfigurationOverride( + return new LocationRestrictions( Review Comment: Fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org