Repository: kylin
Updated Branches:
  refs/heads/master 5dbc083e8 -> b88c6223a


KYLIN-3190

Signed-off-by: Billy Liu <billy...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/b88c6223
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/b88c6223
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/b88c6223

Branch: refs/heads/master
Commit: b88c6223aab7d98fb10450f5b55493f5f7268593
Parents: 5dbc083
Author: peng.jianhua <peng.jian...@zte.com.cn>
Authored: Wed Jan 24 14:48:46 2018 +0800
Committer: Billy Liu <billy...@apache.org>
Committed: Wed Jan 24 15:00:50 2018 +0800

----------------------------------------------------------------------
 .../kylin/rest/controller/AccessController.java | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/b88c6223/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java
----------------------------------------------------------------------
diff --git 
a/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java
 
b/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java
index 9585f79..3b619b8 100644
--- 
a/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java
+++ 
b/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java
@@ -160,23 +160,26 @@ public class AccessController extends BasicController {
      * @param accessRequest
      */
     @RequestMapping(value = "/{type}/{uuid}", method = { RequestMethod.DELETE 
}, produces = { "application/json" })
-    public List<AccessEntryResponse> revoke(@PathVariable String entityType, 
@PathVariable String uuid, AccessRequest accessRequest) throws IOException {
-        AclEntity ae = accessService.getAclEntity(entityType, uuid);
+    public List<AccessEntryResponse> revoke(@PathVariable String type, 
@PathVariable String uuid, AccessRequest accessRequest) throws IOException {
+        AclEntity ae = accessService.getAclEntity(type, uuid);
         Acl acl = accessService.revoke(ae, accessRequest.getAccessEntryId());
-        String type;
+
         if (accessRequest.isPrincipal()) {
-            type = MetadataConstants.TYPE_USER;
+            revokeTableACL(type, uuid, accessRequest.getSid(), 
MetadataConstants.TYPE_USER);
         } else {
-            type = MetadataConstants.TYPE_GROUP;
+            revokeTableACL(type, uuid, accessRequest.getSid(), 
MetadataConstants.TYPE_GROUP);
         }
-        if (AclEntityType.PROJECT_INSTANCE.equals(type)) {
+
+        return accessService.generateAceResponses(acl);
+    }
+
+    private void revokeTableACL(String entityType, String uuid, String name, 
String identityType) throws IOException {
+        if (AclEntityType.PROJECT_INSTANCE.equals(entityType)) {
             String prj = 
projectService.getProjectManager().getPrjByUuid(uuid).getName();
-            String username = accessRequest.getSid();
-            if (tableACLService.exists(prj, username, type)) {
-                tableACLService.deleteFromTableACL(prj, username, type);
+            if (tableACLService.exists(prj, name, identityType)) {
+                tableACLService.deleteFromTableACL(prj, name, identityType);
             }
         }
-        return accessService.generateAceResponses(acl);
     }
 
     /**

Reply via email to