Skip to content
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

Authorize table parameters in CTAS and remove deprecated check methods #10939

Merged

Conversation

findepi
Copy link
Member

@findepi findepi commented Feb 3, 2022

Access controls interfaces allow implementor to inspect new table's
properties. This is done for CREATE TABLE, but was not done for CREATE TABLE AS.
Instead, a deprecated access control method was called.

Follows #9401

Access controls interfaces allow implementor to inspect new table's
properties. This is done for CREATE TABLE`, but was not done for `CREATE
TABLE AS`. Instead, a deprecated access control method was called.
Remove `ConnectorAccessControl` and `SystemAccessControl`'s
`checkCanCreateTable` and `checkCanCreateMaterializedView` checks that
do not take properties that were deprecated some time ago. Remove
associated fallback configuration toggle.

Among other things, this forces plugin implementors to implement the
correct method. This is important, because the old method did not
delegate to the new, nor vice versa.
Copy link
Member

@dain dain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find!

I suggest we leave the deprecated methods in connector and system access control, and have the new methods pass through to them. This way we don't break someone who did not realize we changed the signature.

* @deprecated use {@link #checkCanCreateTable(ConnectorSecurityContext context, SchemaTableName tableName, Map properties)} instead
*/
@Deprecated
default void checkCanCreateTable(ConnectorSecurityContext context, SchemaTableName tableName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we leave the deprecated methods in connector and system access control, and have the new methods pass through to them. This way we don't break someone who did not realize we changed the signature.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this is how this should be implemented in the first place, in 364 when the new methods were added.
But now, it's not worthwhile to fix it, and we want to remove the deprecated methods at some point in time anyway. IMO the time is now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, didn't realize it was that long ago. I guess we have what we have

@findepi findepi requested a review from dain February 4, 2022 08:43
* @deprecated use {@link #checkCanCreateTable(ConnectorSecurityContext context, SchemaTableName tableName, Map properties)} instead
*/
@Deprecated
default void checkCanCreateTable(ConnectorSecurityContext context, SchemaTableName tableName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, didn't realize it was that long ago. I guess we have what we have

@findepi findepi merged commit 72ca4dc into trinodb:master Feb 5, 2022
@findepi findepi deleted the findepi/check-create-with-properties branch February 5, 2022 17:58
@findepi findepi mentioned this pull request Feb 5, 2022
@github-actions github-actions bot added this to the 371 milestone Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants