From fa3502f1f79b59416023277b94858417ccaa7452 Mon Sep 17 00:00:00 2001 From: "peng.jianhua" Date: Wed, 24 Jan 2018 14:48:46 +0800 Subject: [PATCH 1/1] KYLIN-3190 --- .../kylin/rest/controller/AccessController.java | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) 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 9585f7976..3b619b8d1 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 revoke(@PathVariable String entityType, @PathVariable String uuid, AccessRequest accessRequest) throws IOException { - AclEntity ae = accessService.getAclEntity(entityType, uuid); + public List 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); } /** -- 2.11.0.windows.1