Skip to content

Commit

Permalink
Add grant/revoke schema privileges methods to hive metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav8297 authored and kokosing committed Jul 8, 2021
1 parent cdbf453 commit 8b2dabd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2702,6 +2702,18 @@ public Set<String> listEnabledRoles(ConnectorSession session)
return accessControlMetadata.listEnabledRoles(session);
}

@Override
public void grantSchemaPrivileges(ConnectorSession session, String schemaName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)
{
accessControlMetadata.grantSchemaPrivileges(session, schemaName, privileges, HivePrincipal.from(grantee), grantOption);
}

@Override
public void revokeSchemaPrivileges(ConnectorSession session, String schemaName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)
{
accessControlMetadata.revokeSchemaPrivileges(session, schemaName, privileges, HivePrincipal.from(grantee), grantOption);
}

@Override
public void grantTablePrivileges(ConnectorSession session, SchemaTableName schemaTableName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,36 @@ default Set<String> listEnabledRoles(ConnectorSession session)
throw new TrinoException(NOT_SUPPORTED, "This connector does not support roles");
}

/**
* Grants the specified privilege to the specified user on the specified schema
*/
default void grantSchemaPrivileges(ConnectorSession session, String schemaName, Set<Privilege> privileges, HivePrincipal grantee, boolean grantOption)
{
throw new TrinoException(NOT_SUPPORTED, "This connector does not support grants on schemas");
}

/**
* Revokes the specified privilege on the specified schema from the specified user
*/
default void revokeSchemaPrivileges(ConnectorSession session, String schemaName, Set<Privilege> privileges, HivePrincipal grantee, boolean grantOption)
{
throw new TrinoException(NOT_SUPPORTED, "This connector does not support revokes on schemas");
}

/**
* Grants the specified privilege to the specified user on the specified table
*/
default void grantTablePrivileges(ConnectorSession session, SchemaTableName tableName, Set<Privilege> privileges, HivePrincipal grantee, boolean grantOption)
{
throw new TrinoException(NOT_SUPPORTED, "This connector does not support grants");
throw new TrinoException(NOT_SUPPORTED, "This connector does not support grants on tables");
}

/**
* Revokes the specified privilege on the specified table from the specified user
*/
default void revokeTablePrivileges(ConnectorSession session, SchemaTableName tableName, Set<Privilege> privileges, HivePrincipal grantee, boolean grantOption)
{
throw new TrinoException(NOT_SUPPORTED, "This connector does not support revokes");
throw new TrinoException(NOT_SUPPORTED, "This connector does not support revokes on tables");
}

/**
Expand Down

0 comments on commit 8b2dabd

Please sign in to comment.