You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by me...@apache.org on 2019/05/14 09:03:28 UTC

[ranger] branch master updated: RANGER-2417 : Set Atlas Entity owner to RangerAccessResource ownerUser attribute for Atlas Ranger Plugin

This is an automated email from the ASF dual-hosted git repository.

mehul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new 276f221  RANGER-2417 : Set Atlas Entity owner to RangerAccessResource ownerUser attribute for Atlas Ranger Plugin
276f221 is described below

commit 276f2215fc424ba06cef56a4c432e99914482015
Author: nixonrodrigues <ni...@apache.org>
AuthorDate: Fri May 10 14:49:48 2019 +0530

    RANGER-2417 : Set Atlas Entity owner to RangerAccessResource ownerUser attribute for Atlas Ranger Plugin
    
    Signed-off-by: Mehul Parikh <me...@apache.org>
---
 .../ranger/authorization/atlas/authorizer/RangerAtlasAuthorizer.java   | 3 ++-
 .../main/java/org/apache/ranger/services/atlas/RangerServiceAtlas.java | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/plugin-atlas/src/main/java/org/apache/ranger/authorization/atlas/authorizer/RangerAtlasAuthorizer.java b/plugin-atlas/src/main/java/org/apache/ranger/authorization/atlas/authorizer/RangerAtlasAuthorizer.java
index bf588e2..b52a22e 100644
--- a/plugin-atlas/src/main/java/org/apache/ranger/authorization/atlas/authorizer/RangerAtlasAuthorizer.java
+++ b/plugin-atlas/src/main/java/org/apache/ranger/authorization/atlas/authorizer/RangerAtlasAuthorizer.java
@@ -340,10 +340,11 @@ public class RangerAtlasAuthorizer implements AtlasAuthorizer {
             final String                   classification = request.getClassification() != null ? request.getClassification().getTypeName() : null;
             final RangerAccessRequestImpl  rangerRequest  = new RangerAccessRequestImpl();
             final RangerAccessResourceImpl rangerResource = new RangerAccessResourceImpl();
+            final String                   ownerUser      = request.getEntity() != null ? (String) request.getEntity().getAttribute(RESOURCE_ENTITY_OWNER) : null;
 
             rangerResource.setValue(RESOURCE_ENTITY_TYPE, entityTypes);
             rangerResource.setValue(RESOURCE_ENTITY_ID, entityId);
-
+            rangerResource.setOwnerUser(ownerUser);
             rangerRequest.setAccessType(action);
             rangerRequest.setAction(action);
             rangerRequest.setUser(request.getUser());
diff --git a/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/RangerServiceAtlas.java b/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/RangerServiceAtlas.java
index 99510a4..459e791 100644
--- a/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/RangerServiceAtlas.java
+++ b/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/RangerServiceAtlas.java
@@ -62,6 +62,7 @@ public class RangerServiceAtlas extends RangerBaseService {
 	public static final String RESOURCE_ENTITY_TYPE                   = "entity-type";
 	public static final String RESOURCE_ENTITY_CLASSIFICATION         = "entity-classification";
 	public static final String RESOURCE_ENTITY_ID                     = "entity";
+	public static final String RESOURCE_ENTITY_OWNER                  = "owner";
 	public static final String RESOURCE_RELATIONSHIP_TYPE             = "relationship-type";
 	public static final String RESOURCE_END_ONE_ENTITY_TYPE           = "end-one-entity-type";
 	public static final String RESOURCE_END_ONE_ENTITY_CLASSIFICATION = "end-one-entity-classification";