Repository: sentry Updated Branches: refs/heads/master 6d79016aa -> d94e900af
http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java index 9e41a33..f680bc7 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java @@ -18,8 +18,8 @@ package org.apache.sentry.provider.db.service.persistent; -import static org.apache.sentry.policy.common.PolicyConstants.AUTHORIZABLE_JOINER; -import static org.apache.sentry.policy.common.PolicyConstants.KV_JOINER; +import static org.apache.sentry.core.common.utils.SentryConstants.AUTHORIZABLE_JOINER; +import static org.apache.sentry.core.common.utils.SentryConstants.KV_JOINER; import java.io.IOException; import java.util.ArrayList; @@ -47,9 +47,9 @@ import javax.jdo.Transaction; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.sentry.SentryUserException; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.core.model.db.AccessConstants; import org.apache.sentry.core.model.db.DBModelAuthorizable.AuthorizableType; -import org.apache.sentry.policy.common.PolicyConstants; import org.apache.sentry.provider.db.SentryAccessDeniedException; import org.apache.sentry.provider.db.SentryAlreadyExistsException; import org.apache.sentry.provider.db.SentryGrantDeniedException; @@ -1461,7 +1461,7 @@ public class SentryStore { if (!isNULL(privilege.getAction()) && !privilege.getAction().equalsIgnoreCase(AccessConstants.ALL)) { authorizable - .add(KV_JOINER.join(PolicyConstants.PRIVILEGE_NAME.toLowerCase(), + .add(KV_JOINER.join(SentryConstants.PRIVILEGE_NAME.toLowerCase(), privilege.getAction())); } return AUTHORIZABLE_JOINER.join(authorizable); http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/CommandUtil.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/CommandUtil.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/CommandUtil.java index fa7fc6e..c229374 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/CommandUtil.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/CommandUtil.java @@ -18,8 +18,8 @@ package org.apache.sentry.provider.db.tools.command.hive; import org.apache.commons.lang.StringUtils; -import org.apache.sentry.policy.common.KeyValue; -import org.apache.sentry.policy.common.PolicyConstants; +import org.apache.sentry.core.common.utils.SentryConstants; +import org.apache.sentry.core.common.utils.KeyValue; import org.apache.sentry.provider.common.PolicyFileConstants; import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption; import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege; @@ -32,7 +32,7 @@ public class CommandUtil { // parse the privilege in String and get the TSentryPrivilege as result public static TSentryPrivilege convertToTSentryPrivilege(String privilegeStr) throws Exception { TSentryPrivilege tSentryPrivilege = new TSentryPrivilege(); - for (String authorizable : PolicyConstants.AUTHORIZABLE_SPLITTER.split(privilegeStr)) { + for (String authorizable : SentryConstants.AUTHORIZABLE_SPLITTER.split(privilegeStr)) { KeyValue tempKV = new KeyValue(authorizable); String key = tempKV.getKey(); String value = tempKV.getValue(); http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/ListPrivilegesCmd.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/ListPrivilegesCmd.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/ListPrivilegesCmd.java index d990ef3..f671322 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/ListPrivilegesCmd.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/ListPrivilegesCmd.java @@ -19,7 +19,7 @@ package org.apache.sentry.provider.db.tools.command.hive; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; -import org.apache.sentry.policy.common.PolicyConstants; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.provider.common.PolicyFileConstants; import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient; import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption; @@ -64,34 +64,34 @@ public class ListPrivilegesCmd implements Command { String grantOption = (tSentryPrivilege.getGrantOption() == TSentryGrantOption.TRUE ? "true" : "false"); if (!StringUtils.isEmpty(serverName)) { - privileges.add(PolicyConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_SERVER_NAME, + privileges.add(SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_SERVER_NAME, serverName)); if (!StringUtils.isEmpty(uri)) { - privileges.add(PolicyConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_URI_NAME, + privileges.add(SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_URI_NAME, uri)); } else if (!StringUtils.isEmpty(dbName)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_DATABASE_NAME, dbName)); if (!StringUtils.isEmpty(tableName)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_TABLE_NAME, tableName)); if (!StringUtils.isEmpty(columnName)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_COLUMN_NAME, columnName)); } } } if (!StringUtils.isEmpty(action)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_ACTION_NAME, action)); } } // only append the grant option to privilege string if it's true if ("true".equals(grantOption)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME, grantOption)); } } - return PolicyConstants.AUTHORIZABLE_JOINER.join(privileges); + return SentryConstants.AUTHORIZABLE_JOINER.join(privileges); } } http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java index 1da17ee..ae847eb 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java @@ -23,8 +23,8 @@ import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; -import org.apache.sentry.policy.common.KeyValue; -import org.apache.sentry.policy.common.PolicyConstants; +import org.apache.sentry.core.common.utils.SentryConstants; +import org.apache.sentry.core.common.utils.KeyValue; import org.apache.sentry.provider.common.PolicyFileConstants; import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption; import org.apache.sentry.provider.db.service.thrift.TSentryPrivilege; @@ -37,7 +37,7 @@ public class SentryServiceUtil { // parse the privilege in String and get the TSentryPrivilege as result public static TSentryPrivilege convertToTSentryPrivilege(String privilegeStr) { TSentryPrivilege tSentryPrivilege = new TSentryPrivilege(); - for (String authorizable : PolicyConstants.AUTHORIZABLE_SPLITTER.split(privilegeStr)) { + for (String authorizable : SentryConstants.AUTHORIZABLE_SPLITTER.split(privilegeStr)) { KeyValue tempKV = new KeyValue(authorizable); String key = tempKV.getKey(); String value = tempKV.getValue(); @@ -74,7 +74,7 @@ public class SentryServiceUtil { if (StringUtils.isEmpty(objectPath)) { return objectMap; } - for (String kvStr : PolicyConstants.AUTHORIZABLE_SPLITTER.split(objectPath)) { + for (String kvStr : SentryConstants.AUTHORIZABLE_SPLITTER.split(objectPath)) { KeyValue kv = new KeyValue(kvStr); String key = kv.getKey(); String value = kv.getValue(); @@ -120,34 +120,34 @@ public class SentryServiceUtil { String grantOption = (tSentryPrivilege.getGrantOption() == TSentryGrantOption.TRUE ? "true" : "false"); if (!StringUtils.isEmpty(serverName)) { - privileges.add(PolicyConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_SERVER_NAME, + privileges.add(SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_SERVER_NAME, serverName)); if (!StringUtils.isEmpty(uri)) { - privileges.add(PolicyConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_URI_NAME, + privileges.add(SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_URI_NAME, uri)); } else if (!StringUtils.isEmpty(dbName)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_DATABASE_NAME, dbName)); if (!StringUtils.isEmpty(tableName)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_TABLE_NAME, tableName)); if (!StringUtils.isEmpty(columnName)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_COLUMN_NAME, columnName)); } } } if (!StringUtils.isEmpty(action)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_ACTION_NAME, action)); } } // only append the grant option to privilege string if it's true if ("true".equals(grantOption)) { - privileges.add(PolicyConstants.KV_JOINER.join( + privileges.add(SentryConstants.KV_JOINER.join( PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME, grantOption)); } } - return PolicyConstants.AUTHORIZABLE_JOINER.join(privileges); + return SentryConstants.AUTHORIZABLE_JOINER.join(privileges); } } http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/tools/TestSentryShellKafka.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/tools/TestSentryShellKafka.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/tools/TestSentryShellKafka.java index 7d25ae1..d49bc57 100644 --- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/tools/TestSentryShellKafka.java +++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/generic/tools/TestSentryShellKafka.java @@ -22,7 +22,7 @@ import com.google.common.collect.Sets; import com.google.common.io.Files; import org.apache.commons.io.FileUtils; import org.apache.sentry.SentryUserException; -import org.apache.sentry.policy.kafka.KafkaPrivilegeValidator; +import org.apache.sentry.core.model.kafka.validator.KafkaPrivilegeValidator; import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceIntegrationBase; import org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege; import org.apache.sentry.provider.db.generic.service.thrift.TSentryRole; http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceImportExport.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceImportExport.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceImportExport.java index 8d8f28c..865f66e 100644 --- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceImportExport.java +++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceImportExport.java @@ -25,7 +25,7 @@ import static org.junit.Assert.fail; import java.util.Map; import java.util.Set; -import org.apache.sentry.policy.common.PolicyConstants; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.provider.common.PolicyFileConstants; import org.apache.sentry.service.thrift.SentryServiceIntegrationBase; import org.junit.Before; @@ -696,8 +696,8 @@ public class TestSentryServiceImportExport extends SentryServiceIntegrationBase for (String actualPrivilege : actualPrivileges) { boolean isFound = exceptedPrivileges.contains(actualPrivilege); if (!isFound) { - String withOptionPrivilege = PolicyConstants.AUTHORIZABLE_JOINER.join(actualPrivilege, - PolicyConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME, + String withOptionPrivilege = SentryConstants.AUTHORIZABLE_JOINER.join(actualPrivilege, + SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME, "false")); isFound = exceptedPrivileges.contains(withOptionPrivilege); } http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupMappingService.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupMappingService.java b/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupMappingService.java index fed1195..72e219d 100644 --- a/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupMappingService.java +++ b/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupMappingService.java @@ -26,7 +26,7 @@ import java.util.Set; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; -import org.apache.sentry.policy.common.PolicyConstants; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.provider.common.GroupMappingService; import org.apache.sentry.provider.common.PolicyFileConstants; import org.apache.sentry.provider.common.SentryGroupNotFoundException; @@ -111,7 +111,7 @@ public class LocalGroupMappingService implements GroupMappingService { " in the " + resourcePath); continue; } - Set<String> groupList = Sets.newHashSet(PolicyConstants.ROLE_SPLITTER.trimResults().split( + Set<String> groupList = Sets.newHashSet(SentryConstants.ROLE_SPLITTER.trimResults().split( groupNames)); LOGGER.debug("Got user mapping: " + userName + ", Groups: " + groupNames); groupMap.put(userName, groupList); http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupResourceAuthorizationProvider.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupResourceAuthorizationProvider.java b/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupResourceAuthorizationProvider.java index 489daf4..a9e7836 100644 --- a/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupResourceAuthorizationProvider.java +++ b/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/LocalGroupResourceAuthorizationProvider.java @@ -21,6 +21,7 @@ import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; +import org.apache.sentry.core.common.Model; import org.apache.sentry.policy.common.PolicyEngine; import org.apache.sentry.provider.common.ResourceAuthorizationProvider; @@ -28,11 +29,13 @@ import org.apache.sentry.provider.common.ResourceAuthorizationProvider; public class LocalGroupResourceAuthorizationProvider extends ResourceAuthorizationProvider { - public LocalGroupResourceAuthorizationProvider(String resource, PolicyEngine policy) throws IOException { - super(policy, new LocalGroupMappingService(new Path(resource))); + public LocalGroupResourceAuthorizationProvider(String resource, PolicyEngine policy, + Model model) throws IOException { + super(policy, new LocalGroupMappingService(new Path(resource)), model); } - public LocalGroupResourceAuthorizationProvider(Configuration conf, String resource, PolicyEngine policy) throws IOException { - super(policy, new LocalGroupMappingService(conf, new Path(resource))); + public LocalGroupResourceAuthorizationProvider(Configuration conf, String resource, PolicyEngine policy, + Model model) throws IOException { + super(policy, new LocalGroupMappingService(conf, new Path(resource)), model); } } http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/SimpleFileProviderBackend.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/SimpleFileProviderBackend.java b/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/SimpleFileProviderBackend.java index 8924657..91fd4a3 100644 --- a/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/SimpleFileProviderBackend.java +++ b/sentry-provider/sentry-provider-file/src/main/java/org/apache/sentry/provider/file/SimpleFileProviderBackend.java @@ -16,7 +16,7 @@ */ package org.apache.sentry.provider.file; -import static org.apache.sentry.policy.common.PolicyConstants.ROLE_SPLITTER; +import static org.apache.sentry.core.common.utils.SentryConstants.ROLE_SPLITTER; import java.io.IOException; import java.net.URI; @@ -34,8 +34,8 @@ import org.apache.sentry.core.common.ActiveRoleSet; import org.apache.sentry.core.common.Authorizable; import org.apache.sentry.core.common.SentryConfigurationException; import org.apache.sentry.policy.common.PrivilegeUtils; -import org.apache.sentry.policy.common.PrivilegeValidator; -import org.apache.sentry.policy.common.PrivilegeValidatorContext; +import org.apache.sentry.core.common.validator.PrivilegeValidator; +import org.apache.sentry.core.common.validator.PrivilegeValidatorContext; import org.apache.sentry.provider.common.PolicyFileConstants; import org.apache.sentry.provider.common.ProviderBackend; import org.apache.sentry.provider.common.ProviderBackendContext; http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-solr/solr-sentry-handlers/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-solr/solr-sentry-handlers/pom.xml b/sentry-solr/solr-sentry-handlers/pom.xml index 7dae417..4073359 100644 --- a/sentry-solr/solr-sentry-handlers/pom.xml +++ b/sentry-solr/solr-sentry-handlers/pom.xml @@ -67,10 +67,6 @@ limitations under the License. </dependency> <dependency> <groupId>org.apache.sentry</groupId> - <artifactId>sentry-policy-search</artifactId> - </dependency> - <dependency> - <groupId>org.apache.sentry</groupId> <artifactId>solr-sentry-core</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-tests/sentry-tests-hive/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/pom.xml b/sentry-tests/sentry-tests-hive/pom.xml index 44b5b7e..9d2ef76 100644 --- a/sentry-tests/sentry-tests-hive/pom.xml +++ b/sentry-tests/sentry-tests-hive/pom.xml @@ -244,11 +244,6 @@ limitations under the License. <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.sentry</groupId> - <artifactId>sentry-policy-db</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-minicluster</artifactId> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java index 8515a2b..cb5039b 100644 --- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java +++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java @@ -16,9 +16,9 @@ */ package org.apache.sentry.tests.e2e.hive; -import static org.apache.sentry.policy.common.PolicyConstants.AUTHORIZABLE_SPLITTER; -import static org.apache.sentry.policy.common.PolicyConstants.PRIVILEGE_PREFIX; -import static org.apache.sentry.policy.common.PolicyConstants.ROLE_SPLITTER; +import static org.apache.sentry.core.common.utils.SentryConstants.AUTHORIZABLE_SPLITTER; +import static org.apache.sentry.core.common.utils.SentryConstants.PRIVILEGE_PREFIX; +import static org.apache.sentry.core.common.utils.SentryConstants.ROLE_SPLITTER; import java.io.File; import java.io.IOException; @@ -49,7 +49,7 @@ import org.apache.sentry.binding.hive.SentryHiveAuthorizationTaskFactoryImpl; import org.apache.sentry.binding.metastore.SentryMetastorePostEventListener; import org.apache.sentry.core.model.db.DBModelAction; import org.apache.sentry.core.model.db.DBModelAuthorizable; -import org.apache.sentry.policy.db.DBModelAuthorizables; +import org.apache.sentry.core.model.db.DBModelAuthorizables; import org.apache.sentry.provider.db.SimpleDBProviderBackend; import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient; import org.apache.sentry.provider.file.PolicyFile; http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPerDBConfiguration.java ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPerDBConfiguration.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPerDBConfiguration.java index 985f969..d1a34a8 100644 --- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPerDBConfiguration.java +++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPerDBConfiguration.java @@ -26,7 +26,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import org.apache.sentry.policy.db.SimpleDBPolicyEngine; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.provider.file.PolicyFile; import org.junit.After; import org.junit.Before; @@ -116,7 +116,7 @@ public class TestPerDBConfiguration extends AbstractTestWithStaticConfiguration @After public void teardown() throws Exception { // one test turns this on so let's disable it in the teardown method - System.setProperty(SimpleDBPolicyEngine.ACCESS_ALLOW_URI_PER_DB_POLICYFILE, "false"); + System.setProperty(SentryConstants.ACCESS_ALLOW_URI_PER_DB_POLICYFILE, "false"); } @Test @@ -261,7 +261,7 @@ public class TestPerDBConfiguration extends AbstractTestWithStaticConfiguration // ugly hack: needs to go away once this becomes a config property. Note that this property // will not be set with external HS and this test will fail. Hope is this fix will go away // by then. - System.setProperty(SimpleDBPolicyEngine.ACCESS_ALLOW_URI_PER_DB_POLICYFILE, "true"); + System.setProperty(SentryConstants.ACCESS_ALLOW_URI_PER_DB_POLICYFILE, "true"); // test execution Connection connection = context.createConnection(USER1_1); Statement statement = context.createStatement(connection); @@ -290,11 +290,11 @@ public class TestPerDBConfiguration extends AbstractTestWithStaticConfiguration context.assertAuthzException(statement, "USE " + DB1); // once we disable this property all queries should fail - System.setProperty(SimpleDBPolicyEngine.ACCESS_ALLOW_URI_PER_DB_POLICYFILE, "false"); + System.setProperty(SentryConstants.ACCESS_ALLOW_URI_PER_DB_POLICYFILE, "false"); context.assertAuthzException(statement, "USE " + DB2); // re-enable for clean - System.setProperty(SimpleDBPolicyEngine.ACCESS_ALLOW_URI_PER_DB_POLICYFILE, "true"); + System.setProperty(SentryConstants.ACCESS_ALLOW_URI_PER_DB_POLICYFILE, "true"); statement.close(); connection.close(); http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPolicyImportExport.java ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPolicyImportExport.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPolicyImportExport.java index 3f3daf5..0d09afd 100644 --- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPolicyImportExport.java +++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPolicyImportExport.java @@ -28,7 +28,7 @@ import java.util.Set; import org.apache.sentry.binding.hive.SentryPolicyFileFormatFactory; import org.apache.sentry.binding.hive.SentryPolicyFileFormatter; import org.apache.sentry.binding.hive.authz.SentryConfigTool; -import org.apache.sentry.policy.common.PolicyConstants; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.provider.common.PolicyFileConstants; import org.junit.Before; import org.junit.BeforeClass; @@ -217,8 +217,8 @@ public class TestPolicyImportExport extends AbstractTestWithStaticConfiguration for (String actualPrivilege : actualPrivileges) { boolean isFound = exceptedPrivileges.contains(actualPrivilege); if (!isFound) { - String withOptionPrivilege = PolicyConstants.AUTHORIZABLE_JOINER.join(actualPrivilege, - PolicyConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME, + String withOptionPrivilege = SentryConstants.AUTHORIZABLE_JOINER.join(actualPrivilege, + SentryConstants.KV_JOINER.join(PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME, "false")); isFound = exceptedPrivileges.contains(withOptionPrivilege); } http://git-wip-us.apache.org/repos/asf/sentry/blob/d94e900a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/SentryPolicyProviderForDb.java ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/SentryPolicyProviderForDb.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/SentryPolicyProviderForDb.java index 2507f83..1302316 100644 --- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/SentryPolicyProviderForDb.java +++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/SentryPolicyProviderForDb.java @@ -16,9 +16,9 @@ */ package org.apache.sentry.tests.e2e.metastore; -import static org.apache.sentry.policy.common.PolicyConstants.AUTHORIZABLE_SPLITTER; -import static org.apache.sentry.policy.common.PolicyConstants.PRIVILEGE_PREFIX; -import static org.apache.sentry.policy.common.PolicyConstants.ROLE_SPLITTER; +import static org.apache.sentry.core.common.utils.SentryConstants.AUTHORIZABLE_SPLITTER; +import static org.apache.sentry.core.common.utils.SentryConstants.PRIVILEGE_PREFIX; +import static org.apache.sentry.core.common.utils.SentryConstants.ROLE_SPLITTER; import java.io.File; import java.io.IOException; @@ -31,7 +31,7 @@ import org.apache.sentry.core.model.db.AccessConstants; import org.apache.sentry.core.model.db.DBModelAction; import org.apache.sentry.core.model.db.DBModelAuthorizable; import org.apache.sentry.core.model.db.DBModelAuthorizable.AuthorizableType; -import org.apache.sentry.policy.db.DBModelAuthorizables; +import org.apache.sentry.core.model.db.DBModelAuthorizables; import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient; import org.apache.sentry.provider.db.service.thrift.TSentryRole; import org.apache.sentry.provider.file.PolicyFile;
