From 3dd5ace673145de8deb6c731cfe6d8e38af3e4d6 Mon Sep 17 00:00:00 2001 From: Bichitra Kumar Sahoo <32828151+bichitra95@users.noreply.github.com> Date: Thu, 16 May 2024 11:50:21 +0530 Subject: [PATCH 1/5] Add differential entity details for kafka event --- .../v2/preprocessor/contract/ContractPreProcessor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java index bc9ff76cbd..038558dac2 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java @@ -193,6 +193,16 @@ private void updateExistingVersion(EntityMutationContext context, AtlasEntity en context.addUpdated(entity.getGuid(), entity, entityType, vertex); + AtlasEntityComparator entityComparator = new AtlasEntityComparator(typeRegistry, entityRetriever, context.getGuidAssignments(), true, true); + AtlasEntityComparator.AtlasEntityDiffResult diffResult = entityComparator.getDiffResult(entity, vertex, !storeDifferentialAudits); + RequestContext reqContext = RequestContext.get(); + if (diffResult.hasDifference()) { + if (storeDifferentialAudits) { + diffResult.getDiffEntity().setGuid(entity.getGuid()); + reqContext.cacheDifferentialEntity(diffResult.getDiffEntity()); + } + } + } public AtlasEntity getCurrentVersion(String datasetGuid) throws AtlasBaseException { From ef2d14ab92066cb6291a32874900475148207125 Mon Sep 17 00:00:00 2001 From: Bichitra Kumar Sahoo <32828151+bichitra95@users.noreply.github.com> Date: Fri, 7 Jun 2024 15:36:30 +0530 Subject: [PATCH 2/5] Make common method to record mutatedDetails --- .../contract/ContractPreProcessor.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java index 038558dac2..98add96a39 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java @@ -192,16 +192,7 @@ private void updateExistingVersion(EntityMutationContext context, AtlasEntity en AtlasEntityType entityType = ensureEntityType(entity.getTypeName()); context.addUpdated(entity.getGuid(), entity, entityType, vertex); - - AtlasEntityComparator entityComparator = new AtlasEntityComparator(typeRegistry, entityRetriever, context.getGuidAssignments(), true, true); - AtlasEntityComparator.AtlasEntityDiffResult diffResult = entityComparator.getDiffResult(entity, vertex, !storeDifferentialAudits); - RequestContext reqContext = RequestContext.get(); - if (diffResult.hasDifference()) { - if (storeDifferentialAudits) { - diffResult.getDiffEntity().setGuid(entity.getGuid()); - reqContext.cacheDifferentialEntity(diffResult.getDiffEntity()); - } - } + recordEntityMutatedDetails(context, entity, vertex); } @@ -293,11 +284,14 @@ private void datasetAttributeSync(EntityMutationContext context, AtlasEntity ass AtlasVertex vertex = AtlasGraphUtilsV2.findByGuid(entity.getGuid()); AtlasEntityType entityType = ensureEntityType(entity.getTypeName()); + context.addUpdated(entity.getGuid(), entity, entityType, vertex); + recordEntityMutatedDetails(context, entity, vertex); + } + + private void recordEntityMutatedDetails(EntityMutationContext context, AtlasEntity entity, AtlasVertex vertex) throws AtlasBaseException { AtlasEntityComparator entityComparator = new AtlasEntityComparator(typeRegistry, entityRetriever, context.getGuidAssignments(), true, true); AtlasEntityComparator.AtlasEntityDiffResult diffResult = entityComparator.getDiffResult(entity, vertex, !storeDifferentialAudits); RequestContext reqContext = RequestContext.get(); - context.addUpdated(entity.getGuid(), entity, entityType, vertex); - if (diffResult.hasDifference()) { if (storeDifferentialAudits) { diffResult.getDiffEntity().setGuid(entity.getGuid()); From 3ec9024fb092c8a98015e2da25537f2795f4c97c Mon Sep 17 00:00:00 2001 From: arpit-at Date: Thu, 13 Jun 2024 07:15:02 +0530 Subject: [PATCH 3/5] DG-1432 Auth Policies for MQ related Items --- .../policies/bootstrap_entity_policies.json | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) diff --git a/addons/policies/bootstrap_entity_policies.json b/addons/policies/bootstrap_entity_policies.json index 02260d558c..23a77f5298 100644 --- a/addons/policies/bootstrap_entity_policies.json +++ b/addons/policies/bootstrap_entity_policies.json @@ -3108,6 +3108,190 @@ "entity-read" ] } + }, + + { + "typeName": "AuthPolicy", + "attributes": { + "name": "CUD_BUSINESS_POLICY", + "qualifiedName": "CUD_BUSINESS_POLICY", + "policyCategory": "bootstrap", + "policySubCategory": "default", + "policyServiceName": "atlas", + "policyType": "allow", + "policyPriority": 0, + "policyUsers": [], + "policyGroups": [], + "policyRoles": [ + "$admin", + "$api-token-default-access" + ], + "policyResourceCategory": "ENTITY", + "policyResources": [ + "entity-type:BusinessPolicy", + "entity-type:BusinessPolicyException", + "entity-classification:*", + "entity:*" + ], + "policyActions": [ + "entity-create", + "entity-update", + "entity-delete" + ] + } + }, + { + "typeName": "AuthPolicy", + "attributes": { + "name": "READ_BUSINESS_POLICY", + "qualifiedName": "READ_BUSINESS_POLICY", + "policyCategory": "bootstrap", + "policySubCategory": "default", + "policyServiceName": "atlas", + "policyType": "allow", + "policyPriority": 0, + "policyUsers": [], + "policyGroups": [], + "policyRoles": [ + "$admin", + "$guest", + "$member", + "$api-token-default-access" + ], + "policyResourceCategory": "ENTITY", + "policyResources": [ + "entity-type:BusinessPolicy", + "entity-type:BusinessPolicyException", + "entity-classification:*", + "entity:*" + ], + "policyActions": [ + "entity-read" + ] + } + }, + + { + "typeName": "AuthPolicy", + "attributes": { + "name": "CUD_INCIDENT", + "qualifiedName": "CUD_INCIDENT", + "policyCategory": "bootstrap", + "policySubCategory": "default", + "policyServiceName": "atlas", + "policyType": "allow", + "policyPriority": 0, + "policyUsers": [], + "policyGroups": [], + "policyRoles": [ + "$admin", + "$api-token-default-access" + ], + "policyResourceCategory": "ENTITY", + "policyResources": [ + "entity-type:Incident", + "entity-type:BusinessPolicyIncident", + "entity-classification:*", + "entity:*" + ], + "policyActions": [ + "entity-create", + "entity-update", + "entity-delete" + ] + } + }, + { + "typeName": "AuthPolicy", + "attributes": { + "name": "READ_INCIDENT" , + "qualifiedName": "READ_INCIDENT", + "policyCategory": "bootstrap", + "policySubCategory": "default", + "policyServiceName": "atlas", + "policyType": "allow", + "policyPriority": 0, + "policyUsers": [], + "policyGroups": [], + "policyRoles": [ + "$admin", + "$guest", + "$member", + "$api-token-default-access" + ], + "policyResourceCategory": "ENTITY", + "policyResources": [ + "entity-type:Incident", + "entity-type:BusinessPolicyIncident", + "entity-classification:*", + "entity:*" + ], + "policyActions": [ + "entity-read" + ] + } + }, + { + "typeName": "AuthPolicy", + "attributes": { + "name": "CRUD_BUSINESS_POLICY_LOG", + "qualifiedName": "CRUD_BUSINESS_POLICY_LOG", + "policyCategory": "bootstrap", + "policySubCategory": "default", + "policyServiceName": "atlas", + "policyType": "allow", + "policyPriority": 0, + "policyUsers": [], + "policyGroups": [], + "policyRoles": [ + "$admin", + "$api-token-default-access" + ], + "policyResourceCategory": "ENTITY", + "policyResources": [ + "entity-type:BusinessPolicyLog", + "entity-classification:*", + "entity:*" + ], + "policyActions": [ + "entity-create", + "entity-read", + "entity-update", + "entity-delete" + ] + } + }, + { + "typeName": "AuthPolicy", + "attributes": { + "name": "CRUD_TASK", + "qualifiedName": "CRUD_TASK", + "policyCategory": "bootstrap", + "policySubCategory": "default", + "policyServiceName": "atlas", + "policyType": "allow", + "policyPriority": 0, + "policyUsers": [], + "policyGroups": [], + "policyRoles": [ + "$admin", + "$guest", + "$member", + "$api-token-default-access" + ], + "policyResourceCategory": "ENTITY", + "policyResources": [ + "entity-type:Task", + "entity-classification:*", + "entity:*" + ], + "policyActions": [ + "entity-create", + "entity-read", + "entity-update", + "entity-delete" + ] + } } ] } From 31c7a39f152987edf161c5a77a3820c421ce1441 Mon Sep 17 00:00:00 2001 From: arpit-at Date: Thu, 13 Jun 2024 11:14:35 +0530 Subject: [PATCH 4/5] DG-1432 Bootstrap relationship policies for MQ related Items --- .../bootstrap_relationship_policies.json | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/addons/policies/bootstrap_relationship_policies.json b/addons/policies/bootstrap_relationship_policies.json index 6c44567b87..5ac53ccef3 100644 --- a/addons/policies/bootstrap_relationship_policies.json +++ b/addons/policies/bootstrap_relationship_policies.json @@ -760,6 +760,82 @@ "remove-relationship" ] } + }, + { + "typeName": "AuthPolicy", + "attributes": + { + "name": "LINK_BUSINESS_POLICY_BUSINESS_POLICY", + "qualifiedName": "LINK_BUSINESS_POLICY_BUSINESS_POLICY", + "policyCategory": "bootstrap", + "policySubCategory": "default", + "policyServiceName": "atlas", + "policyType": "allow", + "policyUsers": + [], + "policyGroups": + [], + "policyRoles": + [ + "$admin", + "$api-token-default-access" + ], + "policyResourceCategory": "RELATIONSHIP", + "policyResources": + [ + "end-one-entity-classification:*", + "end-two-entity-classification:*", + "end-one-entity:*", + "end-two-entity:*", + "end-one-entity-type:BusinessPolicy", + "end-two-entity-type:BusinessPolicy", + "relationship-type:*" + ], + "policyActions": + [ + "add-relationship", + "update-relationship", + "remove-relationship" + ] + } + }, + { + "typeName": "AuthPolicy", + "attributes": + { + "name": "LINK_BUSINESS_POLICY_BUSINESS_POLICY_EXCEPTION", + "qualifiedName": "LINK_BUSINESS_POLICY_BUSINESS_POLICY_EXCEPTION", + "policyCategory": "bootstrap", + "policySubCategory": "default", + "policyServiceName": "atlas", + "policyType": "allow", + "policyUsers": + [], + "policyGroups": + [], + "policyRoles": + [ + "$admin", + "$api-token-default-access" + ], + "policyResourceCategory": "RELATIONSHIP", + "policyResources": + [ + "end-one-entity-classification:*", + "end-two-entity-classification:*", + "end-one-entity:*", + "end-two-entity:*", + "end-one-entity-type:BusinessPolicy", + "end-two-entity-type:BusinessPolicyException", + "relationship-type:*" + ], + "policyActions": + [ + "add-relationship", + "update-relationship", + "remove-relationship" + ] + } } ] } \ No newline at end of file From 850cf265e9dcfbb134d431c3569ff65530dcba5b Mon Sep 17 00:00:00 2001 From: arpit-at Date: Thu, 13 Jun 2024 17:53:32 +0530 Subject: [PATCH 5/5] DG-1432 Bootstrap relationship policies for MQ related Items --- addons/policies/bootstrap_entity_policies.json | 2 -- addons/policies/bootstrap_relationship_policies.json | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/policies/bootstrap_entity_policies.json b/addons/policies/bootstrap_entity_policies.json index 23a77f5298..38a6b86e80 100644 --- a/addons/policies/bootstrap_entity_policies.json +++ b/addons/policies/bootstrap_entity_policies.json @@ -3190,7 +3190,6 @@ "policyResourceCategory": "ENTITY", "policyResources": [ "entity-type:Incident", - "entity-type:BusinessPolicyIncident", "entity-classification:*", "entity:*" ], @@ -3222,7 +3221,6 @@ "policyResourceCategory": "ENTITY", "policyResources": [ "entity-type:Incident", - "entity-type:BusinessPolicyIncident", "entity-classification:*", "entity:*" ], diff --git a/addons/policies/bootstrap_relationship_policies.json b/addons/policies/bootstrap_relationship_policies.json index 5ac53ccef3..2c123bec6b 100644 --- a/addons/policies/bootstrap_relationship_policies.json +++ b/addons/policies/bootstrap_relationship_policies.json @@ -789,7 +789,7 @@ "end-two-entity:*", "end-one-entity-type:BusinessPolicy", "end-two-entity-type:BusinessPolicy", - "relationship-type:*" + "relationship-type:RelatedBusinessPolicy" ], "policyActions": [ @@ -827,7 +827,7 @@ "end-two-entity:*", "end-one-entity-type:BusinessPolicy", "end-two-entity-type:BusinessPolicyException", - "relationship-type:*" + "relationship-type:BusinessPolicy_BusinessPolicyException" ], "policyActions": [