Skip to content

Commit 7751cfd

Browse files
committed
[hotfix][server] Fix only authorizeTable when authorizer is enabled
1 parent 7eb1391 commit 7751cfd

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

fluss-server/src/main/java/com/alibaba/fluss/server/tablet/TabletService.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -359,21 +359,24 @@ public CompletableFuture<NotifyLakeTableOffsetResponse> notifyLakeTableOffset(
359359
}
360360

361361
private void authorizeTable(OperationType operationType, long tableId) {
362-
TablePath tablePath = metadataCache.getTablePath(tableId).orElse(null);
363-
if (tablePath == null) {
364-
throw new UnknownTableOrBucketException(
365-
String.format(
366-
"This server %s does not know this table ID %s. This may happen when the table "
367-
+ "metadata cache in the server is not updated yet.",
368-
serviceName, tableId));
369-
}
370-
if (authorizer != null
371-
&& !authorizer.isAuthorized(
372-
currentSession(), operationType, Resource.table(tablePath))) {
373-
throw new AuthorizationException(
374-
String.format(
375-
"No permission to %s table %s in database %s",
376-
operationType, tablePath.getTableName(), tablePath.getDatabaseName()));
362+
if (authorizer != null) {
363+
TablePath tablePath = metadataCache.getTablePath(tableId).orElse(null);
364+
if (tablePath == null) {
365+
throw new UnknownTableOrBucketException(
366+
String.format(
367+
"This server %s does not know this table ID %s. This may happen when the table "
368+
+ "metadata cache in the server is not updated yet.",
369+
serviceName, tableId));
370+
}
371+
if (!authorizer.isAuthorized(
372+
currentSession(), operationType, Resource.table(tablePath))) {
373+
throw new AuthorizationException(
374+
String.format(
375+
"No permission to %s table %s in database %s",
376+
operationType,
377+
tablePath.getTableName(),
378+
tablePath.getDatabaseName()));
379+
}
377380
}
378381
}
379382

0 commit comments

Comments
 (0)