Commit 9ffaaaba by nixonrodrigues Committed by Madhan Neethiraj

ATLAS-2515: fix authorization of delete-classification operation

parent 295595db
...@@ -496,7 +496,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore { ...@@ -496,7 +496,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(guid); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(guid);
for (String classification : classificationNames) { 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()) { if (LOG.isDebugEnabled()) {
...@@ -508,6 +508,19 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore { ...@@ -508,6 +508,19 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
entityGraphMapper.deleteClassifications(guid, classificationNames); 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 @Override
@GraphTransaction @GraphTransaction
public List<AtlasClassification> getClassifications(String guid) throws AtlasBaseException { public List<AtlasClassification> getClassifications(String guid) throws AtlasBaseException {
...@@ -758,7 +771,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore { ...@@ -758,7 +771,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
private List<String> getClassificationNames(String guid) throws AtlasBaseException { private List<String> getClassificationNames(String guid) throws AtlasBaseException {
List<String> ret = null; List<String> ret = null;
List<AtlasClassification> classifications = getClassifications(guid); List<AtlasClassification> classifications = retrieveClassifications(guid);
if (CollectionUtils.isNotEmpty(classifications)) { if (CollectionUtils.isNotEmpty(classifications)) {
ret = new ArrayList<>(); ret = new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment