[SYNCOPE-470] Missing push policy setting for Resources
authorFrancesco Chicchiriccò <ilgrosso@apache.org>
Mon, 18 Jun 2018 11:32:45 +0000 (13:32 +0200)
committerFrancesco Chicchiriccò <ilgrosso@apache.org>
Mon, 18 Jun 2018 11:32:45 +0000 (13:32 +0200)
client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.html
client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.properties
client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel_it.properties
client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel_ja.properties
client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel_pt_BR.properties
client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel_ru.properties

index 72ba53d..4a72fb9 100644 (file)
@@ -81,6 +81,17 @@ public class ResourceSecurityPanel extends WizardStep {
         }
     };
 
+    private final IModel<Map<String, String>> pushPolicies = new LoadableDetachableModel<Map<String, String>>() {
+
+        private static final long serialVersionUID = 9089911876466472133L;
+
+        @Override
+        protected Map<String, String> load() {
+            return policyRestClient.getPolicies(PolicyType.PUSH).stream().
+                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getDescription));
+        }
+    };
+
     public ResourceSecurityPanel(final ResourceTO resourceTO) {
         super();
         setOutputMarkupId(true);
@@ -131,5 +142,19 @@ public class ResourceSecurityPanel extends WizardStep {
         ((DropDownChoice<?>) pullPolicy.getField()).setNullValid(true);
         container.add(pullPolicy);
         // -------------------------------
+
+        // -------------------------------
+        // Pull policy selection
+        // -------------------------------
+        AjaxDropDownChoicePanel<String> pushPolicy = new AjaxDropDownChoicePanel<>(
+                "pushPolicy",
+                new ResourceModel("pushPolicy", "pushPolicy").getObject(),
+                new PropertyModel<>(resourceTO, "pushPolicy"),
+                false);
+        pushPolicy.setChoiceRenderer(new PolicyRenderer(pushPolicies));
+        pushPolicy.setChoices(new ArrayList<>(pushPolicies.getObject().keySet()));
+        ((DropDownChoice<?>) pushPolicy.getField()).setNullValid(true);
+        container.add(pushPolicy);
+        // -------------------------------
     }
 }
index 5177e26..fea39ff 100644 (file)
@@ -28,6 +28,9 @@ under the License.
       <span wicket:id="pullPolicy">
         [panel for dynamic input type markup]
       </span>
+      <span wicket:id="pushPolicy">
+        [panel for dynamic input type markup]
+      </span>
     </div>
   </wicket:panel>
 </html>
index 29eae11..7d70763 100644 (file)
@@ -18,3 +18,4 @@
 passwordPolicy = \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439
 accountPolicy = \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439
 pullPolicy=\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445
+pushPolicy=Push Policy