|
21 | 21 | import org.apache.commons.collections4.CollectionUtils; |
22 | 22 | import org.apache.hadoop.conf.Configuration; |
23 | 23 | import org.apache.hadoop.hive.conf.HiveConf; |
24 | | -import org.apache.hadoop.hive.metastore.MetaStoreFilterHook; |
25 | 24 | import org.apache.hadoop.hive.metastore.HMSHandler; |
| 25 | +import org.apache.hadoop.hive.metastore.MetaStoreFilterHook; |
26 | 26 | import org.apache.hadoop.hive.metastore.MetaStorePreEventListener; |
27 | 27 | import org.apache.hadoop.hive.metastore.TableType; |
| 28 | +import org.apache.hadoop.hive.metastore.api.Catalog; |
| 29 | +import org.apache.hadoop.hive.metastore.api.Database; |
28 | 30 | import org.apache.hadoop.hive.metastore.api.InvalidOperationException; |
29 | 31 | import org.apache.hadoop.hive.metastore.api.MetaException; |
30 | 32 | import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; |
| 33 | +import org.apache.hadoop.hive.metastore.api.Partition; |
| 34 | +import org.apache.hadoop.hive.metastore.api.PartitionSpec; |
31 | 35 | import org.apache.hadoop.hive.metastore.api.Table; |
| 36 | +import org.apache.hadoop.hive.metastore.api.TableMeta; |
32 | 37 | import org.apache.hadoop.hive.metastore.events.PreAlterTableEvent; |
33 | 38 | import org.apache.hadoop.hive.metastore.events.PreCreateTableEvent; |
34 | 39 | import org.apache.hadoop.hive.metastore.events.PreDropTableEvent; |
35 | 40 | import org.apache.hadoop.hive.metastore.events.PreEventContext; |
36 | 41 | import org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils; |
37 | | -import org.apache.hadoop.hive.metastore.api.Catalog; |
38 | | -import org.apache.hadoop.hive.metastore.api.Database; |
39 | | -import org.apache.hadoop.hive.metastore.api.Partition; |
40 | | -import org.apache.hadoop.hive.metastore.api.PartitionSpec; |
41 | | -import org.apache.hadoop.hive.metastore.api.TableMeta; |
42 | 42 | import org.apache.hadoop.hive.metastore.utils.MetaStoreUtils; |
43 | 43 | import org.apache.hadoop.hive.ql.metadata.HiveUtils; |
44 | 44 | import org.apache.hadoop.hive.ql.security.HiveAuthenticationProvider; |
45 | | -import static org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObjectUtils.TablePrivilegeLookup; |
46 | | -import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.*; |
47 | 45 | import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAccessControlException; |
48 | 46 | import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthorizer; |
49 | 47 | import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthorizerFactory; |
|
53 | 51 | import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveMetastoreClientFactoryImpl; |
54 | 52 | import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveOperationType; |
55 | 53 | import org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject; |
| 54 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.AddPartitionEvent; |
| 55 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.AlterDataConnectorEvent; |
| 56 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.AlterDatabaseEvent; |
| 57 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.AlterPartitionEvent; |
| 58 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.AlterTableEvent; |
| 59 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.CreateDataConnectorEvent; |
| 60 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.CreateDatabaseEvent; |
| 61 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.CreateFunctionEvent; |
| 62 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.CreateTableEvent; |
| 63 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.DropDataConnectorEvent; |
| 64 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.DropDatabaseEvent; |
| 65 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.DropFunctionEvent; |
| 66 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.DropPartitionEvent; |
| 67 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.DropTableEvent; |
| 68 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.LoadPartitionDoneEvent; |
| 69 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.ReadDatabaseEvent; |
| 70 | +import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events.ReadTableEvent; |
56 | 71 | import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.filtercontext.DataConnectorFilterContext; |
57 | 72 | import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.filtercontext.DatabaseFilterContext; |
58 | 73 | import org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.filtercontext.TableFilterContext; |
|
71 | 86 | import java.util.Set; |
72 | 87 | import java.util.stream.Collectors; |
73 | 88 |
|
| 89 | +import static org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObjectUtils.TablePrivilegeLookup; |
| 90 | + |
74 | 91 | /** |
75 | 92 | * HiveMetaStoreAuthorizer : Do authorization checks on MetaStore Events in MetaStorePreEventListener |
76 | 93 | */ |
@@ -706,7 +723,7 @@ private boolean skipAuthorization(HiveMetaStoreAuthzInfo authzContext) { |
706 | 723 | private boolean isViewType(Table table) { |
707 | 724 | String tableType = table.getTableType(); |
708 | 725 |
|
709 | | - return TableType.ALL_VIEWS.contains(tableType); |
| 726 | + return TableType.ALL_VIEWS_STR.contains(tableType); |
710 | 727 | } |
711 | 728 |
|
712 | 729 | private String getErrorMessage(PreEventContext preEventContext, String user) { |
|
0 commit comments