fimugdha commented on code in PR #1073:
URL: https://github.com/apache/ranger/pull/1073#discussion_r3593574229


##########
security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java:
##########
@@ -101,4 +109,52 @@ protected RangerServiceDef 
mapEntityToViewBean(RangerServiceDef vObj, XXServiceD
 
         return ret;
     }
+
+    @Override
+    protected RangerServiceDef populateViewBean(XXServiceDef xServiceDef) {
+        final RangerServiceDef ret = super.populateViewBean(xServiceDef);
+
+        applyOzoneActionPolicyHiddenOption(ret);
+
+        return ret;
+    }
+
+    void applyOzoneActionPolicyHiddenOption(RangerServiceDef serviceDef) {
+        if (serviceDef == null) {
+            return;
+        }
+
+        Map<String, String> serviceDefOptions = serviceDef.getOptions();
+
+        if (serviceDefOptions == null) {
+            serviceDefOptions = new HashMap<>();
+            serviceDef.setOptions(serviceDefOptions);
+        }
+
+        if (serviceDefOptions.get(OPTION_ENABLE_OZONE_ACTION_POLICY) == null) {
+            boolean enableOzoneActionPolicy = 
config.getBoolean(PROP_ENABLE_OZONE_ACTION_POLICY, false);
+
+            serviceDefOptions.put(OPTION_ENABLE_OZONE_ACTION_POLICY, 
Boolean.toString(enableOzoneActionPolicy));
+            serviceDef.setOptions(serviceDefOptions);

Review Comment:
   This `enableOzoneActionPolicy` option is getting added to all the 
serviceDef, even though they don't support : `RangerActionMatcher` policy 
conditionevaluator.
   
   The `RangerActionMatcher` policy conditionevaluator is currently getting 
used only for ozone serviceDef, then the option should be enabled true/false 
for ozone serviceDef using the xml config value and for other serviceDefs it 
should be set to false.
   
   The name of the option should be kept generic 
`enableActionMatcherInPoliciesCondition` and the config name for 
`ranger-admin-site.xml` can be - 
`ranger.servicedef.ozone.enableActionMatcherInPoliciesCondition`
   
   cc @mneethiraj 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to