Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.fluss.client.admin.Admin;
import org.apache.fluss.client.admin.FlussAdmin;
import org.apache.fluss.client.admin.KvSnapshotLease;
import org.apache.fluss.client.admin.OffsetSpec;
import org.apache.fluss.client.table.Table;
import org.apache.fluss.client.table.scanner.batch.BatchScanner;
import org.apache.fluss.client.table.writer.AppendWriter;
Expand Down Expand Up @@ -416,6 +417,7 @@ void testDescribeTableOperation() throws Exception {
// 4. getLatestKvSnapshots
// 5. listPartitionInfos
// 6. getLatestLakeSnapshot
// 7. listOffsets

// first check call these methods without authorization.
assertThat(guestAdmin.listTables(DATA1_TABLE_PATH_PK.getDatabaseName()).get())
Expand All @@ -426,6 +428,15 @@ void testDescribeTableOperation() throws Exception {
assertNoTableDescribeAuth(() -> guestAdmin.listPartitionInfos(DATA1_TABLE_PATH_PK).get());
assertNoTableDescribeAuth(
() -> guestAdmin.getLatestLakeSnapshot(DATA1_TABLE_PATH_PK).get());
assertNoTableDescribeAuth(
() ->
guestAdmin
.listOffsets(
DATA1_TABLE_PATH_PK,
Arrays.asList(0),
new OffsetSpec.LatestSpec())
.all()
.get());

// add acl to allow guest describe table resource
List<AclBinding> aclBindings =
Expand Down Expand Up @@ -459,6 +470,15 @@ void testDescribeTableOperation() throws Exception {
.rootCause()
.isInstanceOf(LakeTableSnapshotNotExistException.class)
.hasMessageContaining("Lake table snapshot doesn't exist for table");
assertThat(
guestAdmin
.listOffsets(
DATA1_TABLE_PATH_PK,
Arrays.asList(0),
new OffsetSpec.LatestSpec())
.all()
.get())
.isNotEmpty();
}

@ParameterizedTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
import java.util.function.BiFunction;
import java.util.stream.Collectors;

import static org.apache.fluss.security.acl.OperationType.DESCRIBE;
import static org.apache.fluss.security.acl.OperationType.READ;
import static org.apache.fluss.security.acl.OperationType.WRITE;
import static org.apache.fluss.server.coordinator.CoordinatorContext.INITIAL_COORDINATOR_EPOCH;
Expand Down Expand Up @@ -395,7 +396,7 @@ public CompletableFuture<StopReplicaResponse> stopReplica(

@Override
public CompletableFuture<ListOffsetsResponse> listOffsets(ListOffsetsRequest request) {
// TODO: authorize DESCRIBE permission
authorizeTable(DESCRIBE, request.getTableId());
CompletableFuture<ListOffsetsResponse> response = new CompletableFuture<>();
Set<TableBucket> tableBuckets = getListOffsetsData(request);
replicaManager.listOffsets(
Expand Down