Skip to content

Commit 42298bb

Browse files
authored
Add register permission (#213)
Add RegisterTable and RegisterView actions, as well as RegisterLocation condition
1 parent 3de3727 commit 42298bb

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

policy/condition/keyname.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ const (
7474
// S3TablesViewName filters access by the S3 Tables view name within a namespace.
7575
S3TablesViewName KeyName = "s3tables:viewName"
7676

77+
// S3TablesRegisterLocation filters access by the metadata location for table/view registration.
78+
S3TablesRegisterLocation KeyName = "s3tables:registerLocation"
79+
7780
// S3XAmzCopySource - key representing x-amz-copy-source HTTP header applicable to PutObject API only.
7881
S3XAmzCopySource KeyName = "s3:x-amz-copy-source"
7982

@@ -289,6 +292,7 @@ var AllSupportedKeys = []KeyName{
289292
S3TablesNamespace,
290293
S3TablesTableName,
291294
S3TablesViewName,
295+
S3TablesRegisterLocation,
292296
AWSReferer,
293297
AWSSourceIP,
294298
AWSUserAgent,

policy/table-action.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ const (
8282
// S3TablesPutTablePolicyAction maps to the AWS `PutTablePolicy` S3 Tables action.
8383
S3TablesPutTablePolicyAction = "s3tables:PutTablePolicy"
8484

85+
// S3TablesRegisterTableAction maps to the AWS `RegisterTable` S3 Tables action.
86+
S3TablesRegisterTableAction = "s3tables:RegisterTable"
87+
8588
// S3TablesRenameTableAction maps to the AWS `RenameTable` S3 Tables action.
8689
S3TablesRenameTableAction = "s3tables:RenameTable"
8790

@@ -199,6 +202,9 @@ const (
199202
// S3TablesListViewsAction is a MinIO extension for listing Iceberg views.
200203
S3TablesListViewsAction = "s3tables:ListViews"
201204

205+
// S3TablesRegisterViewAction is a MinIO extension for registering Iceberg views.
206+
S3TablesRegisterViewAction = "s3tables:RegisterView"
207+
202208
// S3TablesUpdateNamespacePropertiesAction is a MinIO extension for updating namespace properties.
203209
S3TablesUpdateNamespacePropertiesAction = "s3tables:UpdateNamespaceProperties"
204210

@@ -239,6 +245,7 @@ var SupportedTableActions = map[TableAction]struct{}{
239245
S3TablesPutTableEncryptionAction: {},
240246
S3TablesPutTableMaintenanceConfigurationAction: {},
241247
S3TablesPutTablePolicyAction: {},
248+
S3TablesRegisterTableAction: {},
242249
S3TablesRenameTableAction: {},
243250
S3TablesUpdateTableMetadataLocationAction: {},
244251
S3TablesCreateWarehouseAction: {},
@@ -262,6 +269,7 @@ var SupportedTableActions = map[TableAction]struct{}{
262269
S3TablesRenameViewAction: {},
263270
S3TablesUpdateViewAction: {},
264271
S3TablesListViewsAction: {},
272+
S3TablesRegisterViewAction: {},
265273
S3TablesUpdateNamespacePropertiesAction: {},
266274
AllS3TablesActions: {},
267275
}
@@ -283,6 +291,7 @@ func createTableActionConditionKeyMap() map[Action]condition.KeySet {
283291
s3TablesViewNameKey := condition.S3TablesViewName.ToKey()
284292
s3TablesKMSKeyKey := condition.S3TablesKMSKeyArn.ToKey()
285293
s3TablesSSEAlgorithmKey := condition.S3TablesSSEAlgorithm.ToKey()
294+
s3TablesRegisterLocationKey := condition.S3TablesRegisterLocation.ToKey()
286295

287296
withCommon := func(keys ...condition.Key) condition.KeySet {
288297
merged := append([]condition.Key{}, commonKeys...)
@@ -302,6 +311,7 @@ func createTableActionConditionKeyMap() map[Action]condition.KeySet {
302311
s3TablesViewNameKey,
303312
s3TablesKMSKeyKey,
304313
s3TablesSSEAlgorithmKey,
314+
s3TablesRegisterLocationKey,
305315
)
306316
tableActionConditionKeyMap[S3TablesCreateNamespaceAction] = withCommon(s3TablesNamespaceKey)
307317
tableActionConditionKeyMap[S3TablesCreateTableAction] = withCommon(s3TablesNamespaceKey, s3TablesTableNameKey, s3TablesKMSKeyKey, s3TablesSSEAlgorithmKey)
@@ -334,6 +344,7 @@ func createTableActionConditionKeyMap() map[Action]condition.KeySet {
334344
tableActionConditionKeyMap[S3TablesPutTableEncryptionAction] = withCommon(s3TablesNamespaceKey, s3TablesTableNameKey, s3TablesKMSKeyKey, s3TablesSSEAlgorithmKey)
335345
tableActionConditionKeyMap[S3TablesPutTableMaintenanceConfigurationAction] = withCommon(s3TablesNamespaceKey, s3TablesTableNameKey)
336346
tableActionConditionKeyMap[S3TablesPutTablePolicyAction] = withCommon(s3TablesNamespaceKey, s3TablesTableNameKey)
347+
tableActionConditionKeyMap[S3TablesRegisterTableAction] = withCommon(s3TablesNamespaceKey, s3TablesTableNameKey, s3TablesRegisterLocationKey)
337348
tableActionConditionKeyMap[S3TablesRenameTableAction] = withCommon(s3TablesNamespaceKey, s3TablesTableNameKey)
338349
tableActionConditionKeyMap[S3TablesUpdateTableMetadataLocationAction] = withCommon(s3TablesNamespaceKey, s3TablesTableNameKey)
339350
tableActionConditionKeyMap[S3TablesCreateWarehouseAction] = withCommon(s3TablesKMSKeyKey, s3TablesSSEAlgorithmKey)
@@ -356,6 +367,7 @@ func createTableActionConditionKeyMap() map[Action]condition.KeySet {
356367
tableActionConditionKeyMap[S3TablesGetViewAction] = withCommon(s3TablesNamespaceKey, s3TablesViewNameKey)
357368
tableActionConditionKeyMap[S3TablesRenameViewAction] = withCommon(s3TablesNamespaceKey, s3TablesViewNameKey)
358369
tableActionConditionKeyMap[S3TablesUpdateViewAction] = withCommon(s3TablesNamespaceKey, s3TablesViewNameKey)
370+
tableActionConditionKeyMap[S3TablesRegisterViewAction] = withCommon(s3TablesNamespaceKey, s3TablesViewNameKey, s3TablesRegisterLocationKey)
359371
tableActionConditionKeyMap[S3TablesListViewsAction] = withCommon(s3TablesNamespaceKey)
360372
tableActionConditionKeyMap[S3TablesUpdateNamespacePropertiesAction] = withCommon(s3TablesNamespaceKey)
361373

0 commit comments

Comments
 (0)