You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by an...@apache.org on 2020/10/30 15:33:26 UTC

[syncope] branch master updated: [SYNCOPE-1597] Parametrized layout in console to enable non role-based customization (#225)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new ca95724  [SYNCOPE-1597]  Parametrized layout in console to enable non role-based customization (#225)
ca95724 is described below

commit ca957247ab62bb881ed7c9ab985cb9eda90f10fb
Author: Andrea Patricelli <an...@apache.org>
AuthorDate: Fri Oct 30 16:33:09 2020 +0100

    [SYNCOPE-1597]  Parametrized layout in console to enable non role-based customization (#225)
    
    * [SYNCOPE-1597] Parametrized layout in console to enable non role-based customization
---
 .../org/apache/syncope/client/console/SyncopeWebApplication.java | 9 +++++++++
 .../java/org/apache/syncope/client/console/layout/AnyLayout.java | 8 ++++++--
 client/idrepo/console/src/main/resources/console.properties      | 2 ++
 fit/console-reference/src/main/resources/console.properties      | 2 ++
 fit/core-reference/src/test/resources/console.properties         | 2 ++
 5 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeWebApplication.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeWebApplication.java
index ef8c8e3..7c30fc7 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeWebApplication.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeWebApplication.java
@@ -68,6 +68,7 @@ import org.apache.syncope.client.console.commons.PolicyTabProvider;
 import org.apache.syncope.client.console.commons.StatusProvider;
 import org.apache.syncope.client.console.commons.VirSchemaDetailsPanelProvider;
 import org.apache.syncope.client.console.pages.MustChangePassword;
+import org.apache.syncope.client.console.panels.AnyPanel;
 import org.apache.syncope.client.ui.commons.SyncopeUIRequestCycleListener;
 import org.apache.syncope.client.ui.commons.Constants;
 import org.apache.syncope.common.keymaster.client.api.model.NetworkService;
@@ -142,6 +143,8 @@ public class SyncopeWebApplication extends WicketBootSecuredWebApplication {
     private PolicyTabProvider policyTabProvider;
 
     private Map<String, Class<? extends BasePage>> pageClasses;
+    
+    private String defaultAnyLayoutClass;
 
     @SuppressWarnings("unchecked")
     protected void populatePageClasses(final Properties props) {
@@ -229,6 +232,8 @@ public class SyncopeWebApplication extends WicketBootSecuredWebApplication {
         populatePageClasses(props);
         pageClasses = Collections.unmodifiableMap(pageClasses);
 
+        defaultAnyLayoutClass = props.getProperty("default.any.panel.class", AnyPanel.class.getName());
+        
         // Application settings
         IBootstrapSettings settings = new BootstrapSettings();
 
@@ -393,6 +398,10 @@ public class SyncopeWebApplication extends WicketBootSecuredWebApplication {
         return queueCapacity;
     }
 
+    public String getDefaultAnyLayoutClass() {
+        return defaultAnyLayoutClass;
+    }
+    
     public SyncopeClientFactoryBean newClientFactory() {
         return new SyncopeClientFactoryBean().
                 setAddress(serviceOps.get(NetworkService.Type.CORE).getAddress()).
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/layout/AnyLayout.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/layout/AnyLayout.java
index b15138c..9c00390 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/layout/AnyLayout.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/layout/AnyLayout.java
@@ -24,13 +24,13 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
-import org.apache.syncope.client.console.panels.AnyPanel;
+import org.apache.syncope.client.console.SyncopeWebApplication;
 
 public class AnyLayout implements Serializable {
 
     private static final long serialVersionUID = 488645029994410970L;
 
-    private String anyPanelClass = AnyPanel.class.getName();
+    private String anyPanelClass;
 
     @JsonProperty("USER")
     private UserFormLayoutInfo user;
@@ -40,6 +40,10 @@ public class AnyLayout implements Serializable {
 
     private final Map<String, AnyObjectFormLayoutInfo> anyObjects = new HashMap<>();
 
+    public AnyLayout() {
+        this.anyPanelClass = SyncopeWebApplication.get().getDefaultAnyLayoutClass();
+    }
+
     public String getAnyPanelClass() {
         return anyPanelClass;
     }
diff --git a/client/idrepo/console/src/main/resources/console.properties b/client/idrepo/console/src/main/resources/console.properties
index 06c08b9..3be739e 100644
--- a/client/idrepo/console/src/main/resources/console.properties
+++ b/client/idrepo/console/src/main/resources/console.properties
@@ -39,6 +39,8 @@ page.policies=org.apache.syncope.client.console.pages.Policies
 page.notifications=org.apache.syncope.client.console.pages.Notifications
 page.parameters=org.apache.syncope.client.console.pages.Parameters
 
+default.any.panel.class=org.apache.syncope.client.console.panels.AnyPanel
+
 topology.corePoolSize=10
 topology.maxPoolSize=20
 topology.queueCapacity=50
diff --git a/fit/console-reference/src/main/resources/console.properties b/fit/console-reference/src/main/resources/console.properties
index c8ece6f..32737b9 100644
--- a/fit/console-reference/src/main/resources/console.properties
+++ b/fit/console-reference/src/main/resources/console.properties
@@ -39,6 +39,8 @@ page.policies=org.apache.syncope.client.console.pages.Policies
 page.notifications=org.apache.syncope.client.console.pages.Notifications
 page.parameters=org.apache.syncope.client.console.pages.Parameters
 
+default.any.panel.class=org.apache.syncope.client.console.panels.AnyPanel
+
 topology.corePoolSize=50
 topology.maxPoolSize=100
 topology.queueCapacity=10
diff --git a/fit/core-reference/src/test/resources/console.properties b/fit/core-reference/src/test/resources/console.properties
index 2162ddb..5df90c4 100644
--- a/fit/core-reference/src/test/resources/console.properties
+++ b/fit/core-reference/src/test/resources/console.properties
@@ -39,6 +39,8 @@ page.policies=org.apache.syncope.client.console.pages.Policies
 page.notifications=org.apache.syncope.client.console.pages.Notifications
 page.parameters=org.apache.syncope.client.console.pages.Parameters
 
+default.any.panel.class=org.apache.syncope.client.console.panels.AnyPanel
+
 executor.corePoolSize=50
 executor.maxPoolSize=100
 executor.queueCapacity=10