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

Introduce Hive AccessControlMetadata #972

Merged

Conversation

kokosing
Copy link
Member

No description provided.

@cla-bot cla-bot bot added the cla-signed label Jun 12, 2019
@kokosing kokosing changed the title \ Introduce Hive AccessControlMetadata Jun 12, 2019
@kokosing kokosing requested a review from electrum June 12, 2019 13:35
@kokosing
Copy link
Member Author

Fixes #971

@Override
public void createRole(ConnectorSession session, String role, Optional<HivePrincipal> grantor)
{
// roles are case insensitive in Hive
Copy link
Member

Choose a reason for hiding this comment

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

This comment is confusing, because the code here seems to be case sensitive.

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct. It looks like a bug that existed before. Let me fix that in separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Override
public List<GrantInfo> listTablePrivileges(ConnectorSession session, List<SchemaTableName> tableNames)
{
Set<HivePrincipal> principals = listEnabledPrincipals(metastore, session.getIdentity())
Copy link
Member

Choose a reason for hiding this comment

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

Both usages collect to a set. I'd change the method to return a set.

Copy link
Member Author

Choose a reason for hiding this comment

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

This method listEnabledPrincipals is also used to verify if user has an access to a table. Populating whole set all the time may affect query semantic analysis time.


import io.prestosql.plugin.hive.metastore.SemiTransactionalHiveMetastore;

public class StaticAccessControlMetadataFactory
Copy link
Member

Choose a reason for hiding this comment

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

Let's put this inside StaticAccessControlMetadataModule so that it's consistent with SqlStandardAccessControlMetadataFactory.

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 inlined that.

Thanks to this we can modify and access security access control metadata
depending on which security model is used in Hive Connector.
@kokosing kokosing force-pushed the origin/master/128_access_control_metadata branch 2 times, most recently from dc5cdd3 to 80368b5 Compare July 3, 2019 12:39
@kokosing kokosing merged commit 294200c into trinodb:master Jul 4, 2019
@kokosing kokosing deleted the origin/master/128_access_control_metadata branch July 4, 2019 05:08
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