You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by pr...@apache.org on 2014/11/20 02:28:25 UTC
incubator-sentry git commit: SENTRY-529:
Test]org.apache.sentry.tests.e2e.hdfs.TestHDFSIntegrationtestEnd2End test
fails after SENTRY-74 (Dapeng Sun via Prasad Mujumdar)
Repository: incubator-sentry
Updated Branches:
refs/heads/master d540ad385 -> fa26a0b4f
SENTRY-529: Test]org.apache.sentry.tests.e2e.hdfs.TestHDFSIntegrationtestEnd2End test fails after SENTRY-74 (Dapeng Sun via Prasad Mujumdar)
Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/fa26a0b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/fa26a0b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/fa26a0b4
Branch: refs/heads/master
Commit: fa26a0b4f53345974c9339a4f37bf6e85f78d69c
Parents: d540ad3
Author: Prasad Mujumdar <pr...@cloudera.com>
Authored: Wed Nov 19 17:28:19 2014 -0800
Committer: Prasad Mujumdar <pr...@cloudera.com>
Committed: Wed Nov 19 17:28:19 2014 -0800
----------------------------------------------------------------------
.../org/apache/sentry/hdfs/SentryPlugin.java | 28 +++++++++++++++++---
1 file changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/fa26a0b4/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
index 55b7697..f1e792d 100644
--- a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
+++ b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
@@ -158,11 +158,21 @@ public class SentryPlugin implements SentryPolicyStorePlugin {
public void onAlterSentryRoleGrantPrivilege(
TAlterSentryRoleGrantPrivilegeRequest request)
throws SentryPluginException {
- String authzObj = getAuthzObj(request.getPrivilege());
+ if (request.isSetPrivileges()) {
+ String roleName = request.getRoleName();
+ for (TSentryPrivilege privilege : request.getPrivileges()) {
+ onAlterSentryRoleGrantPrivilegeCore(roleName, privilege);
+ }
+ }
+ }
+
+ private void onAlterSentryRoleGrantPrivilegeCore(String roleName, TSentryPrivilege privilege)
+ throws SentryPluginException {
+ String authzObj = getAuthzObj(privilege);
if (authzObj != null) {
PermissionsUpdate update = new PermissionsUpdate(permSeqNum.incrementAndGet(), false);
update.addPrivilegeUpdate(authzObj).putToAddPrivileges(
- request.getRoleName(), request.getPrivilege().getAction().toUpperCase());
+ roleName, privilege.getAction().toUpperCase());
permsUpdater.handleUpdateNotification(update);
LOGGER.debug("Authz Perm preUpdate [" + update.getSeqNum() + "]..");
}
@@ -185,11 +195,21 @@ public class SentryPlugin implements SentryPolicyStorePlugin {
public void onAlterSentryRoleRevokePrivilege(
TAlterSentryRoleRevokePrivilegeRequest request)
throws SentryPluginException {
- String authzObj = getAuthzObj(request.getPrivilege());
+ if (request.isSetPrivileges()) {
+ String roleName = request.getRoleName();
+ for (TSentryPrivilege privilege : request.getPrivileges()) {
+ onAlterSentryRoleRevokePrivilegeCore(roleName, privilege);
+ }
+ }
+ }
+
+ private void onAlterSentryRoleRevokePrivilegeCore(String roleName, TSentryPrivilege privilege)
+ throws SentryPluginException {
+ String authzObj = getAuthzObj(privilege);
if (authzObj != null) {
PermissionsUpdate update = new PermissionsUpdate(permSeqNum.incrementAndGet(), false);
update.addPrivilegeUpdate(authzObj).putToDelPrivileges(
- request.getRoleName(), request.getPrivilege().getAction().toUpperCase());
+ roleName, privilege.getAction().toUpperCase());
permsUpdater.handleUpdateNotification(update);
LOGGER.debug("Authz Perm preUpdate [" + update.getSeqNum() + ", " + authzObj + "]..");
}