actinium15 commented on a change in pull request #40:
URL: 
https://github.com/apache/sling-org-apache-sling-distribution-core/pull/40#discussion_r415313983



##########
File path: 
src/main/java/org/apache/sling/distribution/agent/impl/PrivilegeDistributionRequestAuthorizationStrategyFactory.java
##########
@@ -59,13 +60,28 @@
     @Property(label = "Jcr Privilege", description = "Jcr privilege to check 
for authorizing distribution requests. The privilege is checked for the calling 
user session.")
     private static final String JCR_PRIVILEGE = "jcrPrivilege";
 
+    /**
+     * privilege ADD request authorization strategy jcr privilege property
+     */
+    @Property(cardinality = 100, label = "Additional Jcr Privileges for Add", 
description = "Additional Jcr privileges to check for authorizing ADD 
distribution requests. " +
+            "The privilege is checked for the calling user session.", value = 
"jcr:read")
+    private static final String JCR_ADD_PRIVILEGES = 
"additionalJcrPrivilegesForAdd";
+
+    /**
+     * privilege DELETE request authorization strategy jcr privilege property
+     */
+    @Property(cardinality = 100, label = "Additional Jcr Privileges for 
Delete", description = "Additional Jcr privileges to check for authorizing 
DELETE distribution requests. " +
+             "The privilege is checked for the calling user session.", value = 
"jcr:removeNode")
+    private static final String JCR_DELETE_PRIVILEGES = 
"additionalJcrPrivilegesForDelete";
 
     private DistributionRequestAuthorizationStrategy authorizationStrategy;
 
     @Activate
     public void activate(BundleContext context, Map<String, Object> config) {
         String jcrPrivilege = 
PropertiesUtil.toString(config.get(JCR_PRIVILEGE), null);
-        authorizationStrategy = new 
PrivilegeDistributionRequestAuthorizationStrategy(jcrPrivilege);
+        String[] jcrAddPrivileges = 
PropertiesUtil.toStringArray(config.get(JCR_ADD_PRIVILEGES), null);
+        String[] jcrDeletePrivileges = 
PropertiesUtil.toStringArray(config.get(JCR_DELETE_PRIVILEGES), null);

Review comment:
       Since the property now has a default, I'd suggest losing the `null` for 
clarity to the reader...
   ```suggestion
           String[] jcrDeletePrivileges = 
PropertiesUtil.toStringArray(config.get(JCR_DELETE_PRIVILEGES));
   ```

##########
File path: 
src/main/java/org/apache/sling/distribution/agent/impl/PrivilegeDistributionRequestAuthorizationStrategyFactory.java
##########
@@ -59,13 +60,28 @@
     @Property(label = "Jcr Privilege", description = "Jcr privilege to check 
for authorizing distribution requests. The privilege is checked for the calling 
user session.")
     private static final String JCR_PRIVILEGE = "jcrPrivilege";
 
+    /**
+     * privilege ADD request authorization strategy jcr privilege property
+     */
+    @Property(cardinality = 100, label = "Additional Jcr Privileges for Add", 
description = "Additional Jcr privileges to check for authorizing ADD 
distribution requests. " +
+            "The privilege is checked for the calling user session.", value = 
"jcr:read")
+    private static final String JCR_ADD_PRIVILEGES = 
"additionalJcrPrivilegesForAdd";
+
+    /**
+     * privilege DELETE request authorization strategy jcr privilege property
+     */
+    @Property(cardinality = 100, label = "Additional Jcr Privileges for 
Delete", description = "Additional Jcr privileges to check for authorizing 
DELETE distribution requests. " +
+             "The privilege is checked for the calling user session.", value = 
"jcr:removeNode")
+    private static final String JCR_DELETE_PRIVILEGES = 
"additionalJcrPrivilegesForDelete";
 
     private DistributionRequestAuthorizationStrategy authorizationStrategy;
 
     @Activate
     public void activate(BundleContext context, Map<String, Object> config) {
         String jcrPrivilege = 
PropertiesUtil.toString(config.get(JCR_PRIVILEGE), null);
-        authorizationStrategy = new 
PrivilegeDistributionRequestAuthorizationStrategy(jcrPrivilege);
+        String[] jcrAddPrivileges = 
PropertiesUtil.toStringArray(config.get(JCR_ADD_PRIVILEGES), null);

Review comment:
       Since the property now has a default, I'd suggest losing the `null` for 
clarity to the reader...
   ```suggestion
           String[] jcrAddPrivileges = 
PropertiesUtil.toStringArray(config.get(JCR_ADD_PRIVILEGES));
   ```




----------------------------------------------------------------
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.

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


Reply via email to