You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2018/03/28 19:15:36 UTC

atlas git commit: ATLAS-2515: fix authorization of delete-classification operation

Repository: atlas
Updated Branches:
  refs/heads/master 295595db4 -> 9ffaaabaa


ATLAS-2515: fix authorization of delete-classification operation

Signed-off-by: Madhan Neethiraj <ma...@apache.org>


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

Branch: refs/heads/master
Commit: 9ffaaabaaf692a07ea74f929515659fa425feff8
Parents: 295595d
Author: nixonrodrigues <ni...@apache.org>
Authored: Wed Mar 28 20:10:11 2018 +0530
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Wed Mar 28 11:17:22 2018 -0700

----------------------------------------------------------------------
 .../store/graph/v1/AtlasEntityStoreV1.java         | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/9ffaaaba/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
index 6fe8570..5bec16e 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
@@ -496,7 +496,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
         AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(guid);
 
         for (String classification : classificationNames) {
-            AtlasAuthorizationUtils.verifyAccess(new AtlasEntityAccessRequest(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_CLASSIFICATION, entityHeader, new AtlasClassification(classification)), "remove classification: guid=", guid, ", classification=", classification);
+            AtlasAuthorizationUtils.verifyAccess(new AtlasEntityAccessRequest(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_CLASSIFICATION, entityHeader, new AtlasClassification(classification)), "remove classification: guid=", guid, ", classification=", classification);
         }
 
         if (LOG.isDebugEnabled()) {
@@ -508,6 +508,19 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
         entityGraphMapper.deleteClassifications(guid, classificationNames);
     }
 
+
+    @GraphTransaction
+    public List<AtlasClassification> retrieveClassifications(String guid) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Retriving classifications for entity={}", guid);
+        }
+
+        AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(guid);
+
+        return entityHeader.getClassifications();
+    }
+
+
     @Override
     @GraphTransaction
     public List<AtlasClassification> getClassifications(String guid) throws AtlasBaseException {
@@ -758,7 +771,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
 
     private List<String> getClassificationNames(String guid) throws AtlasBaseException {
         List<String>              ret             = null;
-        List<AtlasClassification> classifications = getClassifications(guid);
+        List<AtlasClassification> classifications = retrieveClassifications(guid);
 
         if (CollectionUtils.isNotEmpty(classifications)) {
             ret = new ArrayList<>();