Search in sources :

Example 11 with RangerAccessResource

use of org.apache.ranger.plugin.policyengine.RangerAccessResource in project ranger by apache.

the class RangerOptimizedPolicyEvaluator method isOwnerMatch.

private boolean isOwnerMatch(RangerAccessRequest request) {
    boolean ret = false;
    if (hasResourceOwner) {
        RangerAccessResource accessedResource = request.getResource();
        String resourceOwner = accessedResource != null ? accessedResource.getOwnerUser() : null;
        String user = request.getUser();
        if (user != null && resourceOwner != null && user.equals(resourceOwner)) {
            ret = true;
        }
    }
    return ret;
}
Also used : RangerAccessResource(org.apache.ranger.plugin.policyengine.RangerAccessResource)

Example 12 with RangerAccessResource

use of org.apache.ranger.plugin.policyengine.RangerAccessResource in project ranger by apache.

the class RangerAccessRequestUtil method getCurrentResourceFromContext.

public static RangerAccessResource getCurrentResourceFromContext(Map<String, Object> context) {
    RangerAccessResource ret = null;
    Object val = context.get(KEY_CONTEXT_RESOURCE);
    if (val instanceof RangerAccessResource) {
        ret = (RangerAccessResource) val;
    }
    return ret;
}
Also used : RangerAccessResource(org.apache.ranger.plugin.policyengine.RangerAccessResource)

Example 13 with RangerAccessResource

use of org.apache.ranger.plugin.policyengine.RangerAccessResource in project ranger by apache.

the class RangerRequestedResources method toString.

StringBuilder toString(StringBuilder sb) {
    sb.append("AllRequestedHiveResources={");
    for (RangerAccessResource resource : requestedResources) {
        if (resource != null) {
            sb.append(resource.getAsString());
            sb.append("; ");
        }
    }
    sb.append("} ");
    return sb;
}
Also used : RangerAccessResource(org.apache.ranger.plugin.policyengine.RangerAccessResource)

Aggregations

RangerAccessResource (org.apache.ranger.plugin.policyengine.RangerAccessResource)13 JsonSyntaxException (com.google.gson.JsonSyntaxException)4 IOException (java.io.IOException)4 POST (javax.ws.rs.POST)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 WebApplicationException (javax.ws.rs.WebApplicationException)4 RESTResponse (org.apache.ranger.admin.client.datatype.RESTResponse)4 RangerPolicy (org.apache.ranger.plugin.model.RangerPolicy)4 RangerAccessResourceImpl (org.apache.ranger.plugin.policyengine.RangerAccessResourceImpl)4 RangerPerfTracer (org.apache.ranger.plugin.util.RangerPerfTracer)4 VXString (org.apache.ranger.view.VXString)4 RangerAccessRequest (org.apache.ranger.plugin.policyengine.RangerAccessRequest)3 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 AuthzAuditEvent (org.apache.ranger.audit.model.AuthzAuditEvent)2 XXService (org.apache.ranger.entity.XXService)2 XXServiceDef (org.apache.ranger.entity.XXServiceDef)2 RangerPolicyItem (org.apache.ranger.plugin.model.RangerPolicy.RangerPolicyItem)2 RangerPolicyItemAccess (org.apache.ranger.plugin.model.RangerPolicy.RangerPolicyItemAccess)2