JingsongLi commented on code in PR #9393:
URL: https://github.com/apache/paimon/pull/9393#discussion_r3859966479


##########
paimon-api/src/main/java/org/apache/paimon/management/ListPermissionsRequest.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * 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.paimon.management;
+
+import org.apache.paimon.annotation.Experimental;
+
+import javax.annotation.Nullable;
+
+import static org.apache.paimon.utils.Preconditions.checkArgument;
+import static org.apache.paimon.utils.Preconditions.checkNotNull;
+
+/** Exact resource or scope, principal, and pagination filters for permission 
assignments. */
+@Experimental
+public class ListPermissionsRequest {
+
+    public static final int MAX_PAGE_SIZE = 1000;
+
+    private final PermissionResource resource;
+    @Nullable private final String principal;
+    @Nullable private final String access;
+    @Nullable private final String pageToken;
+    @Nullable private final Integer maxResults;
+
+    public ListPermissionsRequest(
+            ResourceType resourceType,
+            @Nullable String database,
+            @Nullable String table,
+            @Nullable String function,
+            @Nullable String view,
+            @Nullable String principal,
+            @Nullable String access,
+            @Nullable String pageToken,
+            @Nullable Integer maxResults) {
+        this.resource = exactResource(resourceType, database, table, function, 
view);
+        if (!isBlank(principal)) {
+            PermissionAssignment.validatePrincipal(principal);
+        }
+        checkArgument(maxResults == null || maxResults > 0, "maxResults must 
be greater than 0.");
+        checkArgument(
+                maxResults == null || maxResults <= MAX_PAGE_SIZE,
+                "maxResults must be at most %s.",
+                MAX_PAGE_SIZE);
+        this.principal = isBlank(principal) ? null : principal;
+        this.access = isBlank(access) ? null : 
PermissionAccess.canonicalize(resource, access);
+        this.pageToken = isBlank(pageToken) ? null : pageToken;

Review Comment:
   Fixed in 8f9b50429d. ListPermissionsRequest now preserves pageToken 
verbatim, including nonempty whitespace-only opaque tokens. Added a regression 
assertion through withPageToken.



##########
paimon-api/src/main/java/org/apache/paimon/management/PermissionAssignment.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * 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.paimon.management;
+
+import org.apache.paimon.annotation.Experimental;
+
+import 
org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import 
org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonGetter;
+import 
org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import 
org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonInclude;
+import 
org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
+import javax.annotation.Nullable;
+
+import java.beans.ConstructorProperties;
+import java.time.Instant;
+import java.time.format.DateTimeParseException;
+
+import static org.apache.paimon.utils.Preconditions.checkArgument;
+import static org.apache.paimon.utils.Preconditions.checkNotNull;
+
+/**
+ * Direct permission assignment on one exact resource or explicit descendant 
scope.
+ *
+ * <p>A {@link ResourceType#COLUMN COLUMN} assignment carries one {@link 
PermissionColumns} value.
+ * The column range is mutable assignment content rather than identity: 
granting the same resource,
+ * access, and principal replaces the complete range.
+ *
+ * <p>{@code expireTime}, when present, is an exclusive authorization upper 
bound evaluated against
+ * the server clock. At or after that instant, the assignment must not 
authorize access, although an
+ * expired record may remain listable until cleanup.
+ */
+@Experimental
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class PermissionAssignment {
+
+    /** Maximum principal identifier length in the portable REST management 
contract. */
+    public static final int MAX_PRINCIPAL_LENGTH = 128;
+
+    private static final String FIELD_RESOURCE = "resource";
+    private static final String FIELD_ACCESS = "access";
+    private static final String FIELD_PRINCIPAL = "principal";
+    private static final String FIELD_COLUMNS = "columns";
+    private static final String FIELD_EXPIRE_TIME = "expireTime";
+
+    @JsonProperty(FIELD_RESOURCE)
+    private final PermissionResource resource;
+
+    @JsonProperty(FIELD_ACCESS)
+    private final String access;
+
+    @JsonProperty(FIELD_PRINCIPAL)
+    private final String principal;
+
+    @Nullable
+    @JsonProperty(FIELD_COLUMNS)
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    private final PermissionColumns columns;
+
+    @Nullable
+    @JsonProperty(FIELD_EXPIRE_TIME)
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    private final String expireTime;
+
+    @JsonCreator

Review Comment:
   Fixed in 8f9b50429d. The public constructor remains strict for grant 
requests, while Jackson response deserialization now uses a package-private 
unvalidated constructor. Added shaded and external Jackson coverage for a 
microsecond-precision expireTime response, while verifying the same value is 
still rejected on the grant request path.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to