-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Notifies systemSecurityMetadata on column add, rename, and drop events if using system security manager #16833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -735,27 +735,41 @@ public void setColumnComment(Session session, TableHandle tableHandle, ColumnHan | |
| } | ||
|
|
||
| @Override | ||
| public void renameColumn(Session session, TableHandle tableHandle, ColumnHandle source, String target) | ||
| public void renameColumn(Session session, TableHandle tableHandle, CatalogSchemaTableName table, ColumnHandle source, String target) | ||
| { | ||
| CatalogHandle catalogHandle = tableHandle.getCatalogHandle(); | ||
| CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogHandle.getCatalogName()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hyper-nit - - since it's only used only in the if stm, I would have been tempted to move the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about that too. I'd rather keep it as-is though, personally; it matches the style of other methods that notify system security metadata. |
||
| ConnectorMetadata metadata = getMetadataForWrite(session, catalogHandle); | ||
| metadata.renameColumn(session.toConnectorSession(catalogHandle), tableHandle.getConnectorHandle(), source, target.toLowerCase(ENGLISH)); | ||
| if (catalogMetadata.getSecurityManagement() == SYSTEM) { | ||
| ColumnMetadata columnMetadata = getColumnMetadata(session, tableHandle, source); | ||
| systemSecurityMetadata.columnRenamed(session, table, columnMetadata.getName(), target); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void addColumn(Session session, TableHandle tableHandle, ColumnMetadata column) | ||
| public void addColumn(Session session, TableHandle tableHandle, CatalogSchemaTableName table, ColumnMetadata column) | ||
| { | ||
| CatalogHandle catalogHandle = tableHandle.getCatalogHandle(); | ||
| CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogHandle.getCatalogName()); | ||
| ConnectorMetadata metadata = getMetadataForWrite(session, catalogHandle); | ||
| metadata.addColumn(session.toConnectorSession(catalogHandle), tableHandle.getConnectorHandle(), column); | ||
| if (catalogMetadata.getSecurityManagement() == SYSTEM) { | ||
| systemSecurityMetadata.columnCreated(session, table, column.getName()); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void dropColumn(Session session, TableHandle tableHandle, ColumnHandle column) | ||
| public void dropColumn(Session session, TableHandle tableHandle, CatalogSchemaTableName table, ColumnHandle column) | ||
| { | ||
| CatalogHandle catalogHandle = tableHandle.getCatalogHandle(); | ||
| CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogHandle.getCatalogName()); | ||
| ConnectorMetadata metadata = getMetadataForWrite(session, catalogHandle); | ||
| metadata.dropColumn(session.toConnectorSession(catalogHandle), tableHandle.getConnectorHandle(), column); | ||
| if (catalogMetadata.getSecurityManagement() == SYSTEM) { | ||
| ColumnMetadata columnMetadata = getColumnMetadata(session, tableHandle, column); | ||
| systemSecurityMetadata.columnDropped(session, table, columnMetadata.getName()); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.