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 9738f68  SYNCOPE-1661 added sidebar layout JSON configuration (#314)
9738f68 is described below

commit 9738f6822a323f009a9fc24793cf084e1c5756fc
Author: Andrea Patricelli <andreapatrice...@apache.org>
AuthorDate: Tue Feb 15 09:00:03 2022 +0100

    SYNCOPE-1661 added sidebar layout JSON configuration (#314)
---
 .../client/enduser/layout/SidebarLayout.java       | 57 ++++++++++++++++++++++
 .../client/enduser/layout/UserFormLayoutInfo.java  | 11 +++++
 .../client/enduser/pages/SelfPasswordReset.java    |  6 +--
 .../syncope/client/enduser/panels/Sidebar.java     | 20 ++++++--
 .../src/main/resources/customFormLayout.json       |  9 +++-
 .../pages/SelfConfirmPasswordReset_it.properties   |  3 +-
 6 files changed, 94 insertions(+), 12 deletions(-)

diff --git 
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/layout/SidebarLayout.java
 
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/layout/SidebarLayout.java
new file mode 100644
index 0000000..030d994
--- /dev/null
+++ 
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/layout/SidebarLayout.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.enduser.layout;
+
+import java.io.Serializable;
+
+public class SidebarLayout implements Serializable {
+
+    private static final long serialVersionUID = 192032086034617378L;
+
+    private boolean editUserEnabled = true;
+
+    private boolean passwordManagementEnabled = true;
+
+    private boolean securityQuestionManagementEnabled = true;
+
+    public boolean isEditUserEnabled() {
+        return editUserEnabled;
+    }
+
+    public void setEditUserEnabled(final boolean editUserEnabled) {
+        this.editUserEnabled = editUserEnabled;
+    }
+
+    public boolean isPasswordManagementEnabled() {
+        return passwordManagementEnabled;
+    }
+
+    public void setPasswordManagementEnabled(final boolean 
passwordManagementEnabled) {
+        this.passwordManagementEnabled = passwordManagementEnabled;
+    }
+
+    public boolean isSecurityQuestionManagementEnabled() {
+        return securityQuestionManagementEnabled;
+    }
+
+    public void setSecurityQuestionManagementEnabled(final boolean 
securityQuestionManagementEnabled) {
+        this.securityQuestionManagementEnabled = 
securityQuestionManagementEnabled;
+    }
+
+}
diff --git 
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/layout/UserFormLayoutInfo.java
 
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/layout/UserFormLayoutInfo.java
index 0c81adc..9a24ac2 100644
--- 
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/layout/UserFormLayoutInfo.java
+++ 
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/layout/UserFormLayoutInfo.java
@@ -39,6 +39,12 @@ public class UserFormLayoutInfo extends 
AbstractAnyFormBaseLayout<UserTO, UserFo
 
     private boolean detailsManagement = true;
 
+    private final SidebarLayout sidebarLayout;
+
+    public UserFormLayoutInfo() {
+        sidebarLayout = new SidebarLayout();
+    }
+
     public Map<String, CustomizationOption> getWhichPlainAttrs() {
         return whichPlainAttrs;
     }
@@ -71,4 +77,9 @@ public class UserFormLayoutInfo extends 
AbstractAnyFormBaseLayout<UserTO, UserFo
     public void setDetailsManagement(final boolean detailsManagement) {
         this.detailsManagement = detailsManagement;
     }
+
+    public SidebarLayout getSidebarLayout() {
+        return sidebarLayout;
+    }
+
 }
diff --git 
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/pages/SelfPasswordReset.java
 
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/pages/SelfPasswordReset.java
index 6c99b55..291645e 100644
--- 
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/pages/SelfPasswordReset.java
+++ 
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/pages/SelfPasswordReset.java
@@ -90,11 +90,7 @@ public class SelfPasswordReset extends BasePage {
 
             @Override
             protected void onSubmit(final AjaxRequestTarget target) {
-                boolean checked = true;
-                if (SyncopeWebApplication.get().isCaptchaEnabled()) {
-                    checked = captcha.check();
-                }
-                if (!checked) {
+                if (SyncopeWebApplication.get().isCaptchaEnabled() && 
!captcha.check()) {
                     
SyncopeEnduserSession.get().error(getString(Constants.CAPTCHA_ERROR));
                     
SelfPasswordReset.this.getNotificationPanel().refresh(target);
                 } else {
diff --git 
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/Sidebar.java
 
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/Sidebar.java
index e393a14..aed7750 100644
--- 
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/Sidebar.java
+++ 
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/Sidebar.java
@@ -174,20 +174,34 @@ public class Sidebar extends Panel {
         add(profileLIContainer);
         profileULContainer = new 
WebMarkupContainer(getULContainerId("profile"));
         profileLIContainer.add(profileULContainer);
+        
profileLIContainer.setVisible(SyncopeWebApplication.get().getCustomFormLayout().getSidebarLayout().
+                isEditUserEnabled()
+                || 
SyncopeWebApplication.get().getCustomFormLayout().getSidebarLayout().
+                isPasswordManagementEnabled()
+                || 
(SyncopeWebApplication.get().getCustomFormLayout().getSidebarLayout().
+                isSecurityQuestionManagementEnabled()
+                && 
SyncopeEnduserSession.get().getPlatformInfo().isPwdResetRequiringSecurityQuestions()));
 
         WebMarkupContainer liContainer = new 
WebMarkupContainer(getLIContainerId("edituser"));
         profileULContainer.add(liContainer);
-        liContainer.add(BookmarkablePageLinkBuilder.build("edituser", 
EditUser.class));
 
+        liContainer.add(BookmarkablePageLinkBuilder.build("edituser", 
EditUser.class))
+                
.setVisible(SyncopeWebApplication.get().getCustomFormLayout().getSidebarLayout()
+                        .isEditUserEnabled());
         liContainer = new 
WebMarkupContainer(getLIContainerId("editchangepassword"));
         profileULContainer.add(liContainer);
-        
liContainer.add(BookmarkablePageLinkBuilder.build("editchangepassword", 
EditChangePassword.class));
+
+        
liContainer.add(BookmarkablePageLinkBuilder.build("editchangepassword", 
EditChangePassword.class))
+                
.setVisible(SyncopeWebApplication.get().getCustomFormLayout().getSidebarLayout().
+                        isPasswordManagementEnabled());
 
         liContainer = new 
WebMarkupContainer(getLIContainerId("editsecurityquestion"));
         profileULContainer.add(liContainer);
         
liContainer.add(BookmarkablePageLinkBuilder.build("editsecurityquestion", 
EditSecurityQuestion.class));
         liContainer.setOutputMarkupPlaceholderTag(true);
-        
liContainer.setVisible(SyncopeEnduserSession.get().getPlatformInfo().isPwdResetRequiringSecurityQuestions());
+        
liContainer.setVisible(SyncopeWebApplication.get().getCustomFormLayout().getSidebarLayout().
+                isSecurityQuestionManagementEnabled()
+                && 
SyncopeEnduserSession.get().getPlatformInfo().isPwdResetRequiringSecurityQuestions());
     }
 
     protected String getLIContainerId(final String linkId) {
diff --git a/client/idrepo/enduser/src/main/resources/customFormLayout.json 
b/client/idrepo/enduser/src/main/resources/customFormLayout.json
index af4f21c..f32bfb0 100644
--- a/client/idrepo/enduser/src/main/resources/customFormLayout.json
+++ b/client/idrepo/enduser/src/main/resources/customFormLayout.json
@@ -1,4 +1,4 @@
-{ 
+{
   "formClass": "org.apache.syncope.client.enduser.panels.UserFormPanel",
   "auxClasses": true,
   "groups": true,
@@ -10,5 +10,10 @@
   "whichDerAttrs": {},
   "whichVirAttrs": {},
   "passwordManagement": true,
-  "detailsManagement": true
+  "detailsManagement": true,
+  "sidebarLayout": {
+    "editUserEnabled": true,
+    "passwordManagementEnabled": true,
+    "securityQuestionManagementEnabled": true
+  }
 }
diff --git 
a/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/pages/SelfConfirmPasswordReset_it.properties
 
b/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/pages/SelfConfirmPasswordReset_it.properties
index c924560..d621ebd 100644
--- 
a/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/pages/SelfConfirmPasswordReset_it.properties
+++ 
b/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/pages/SelfConfirmPasswordReset_it.properties
@@ -22,7 +22,6 @@ cancel=Annulla
 submit=Invia
 self.confirm.pwd.reset.success=Password \u00e8 stata modificata
 self.confirm.pwd.reset.success.msg=Cambio password eseguito con successo
-self.confirm.pwd.reset.error.empty=Nessun token \u00e8 specifico nell'url, non 
\u00e8 possibile accedere alla pagina richiesta
-
+self.confirm.pwd.reset.error.empty=Nessun token \u00e8 specificato nell'url, 
non \u00e8 possibile accedere alla pagina richiesta
 self.confirm.pwd.reset.error=Errore durante il processo di reset password
 self.confirm.pwd.reset.error.msg=Si prega di contattare 

Reply via email to