You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/07/23 10:56:28 UTC

[01/10] syncope git commit: Upgrading Jackson, Hibernate Validator, Checkstyle

Repository: syncope
Updated Branches:
  refs/heads/1_2_X 5d2817ad6 -> 660b0ce88
  refs/heads/SYNCOPE-652 a6cf6a68f -> d1bd87ad9
  refs/heads/master c32826656 -> ce8d4edec


Upgrading Jackson, Hibernate Validator, Checkstyle


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/c3282665
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/c3282665
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/c3282665

Branch: refs/heads/SYNCOPE-652
Commit: c32826656762164a7e42e2d9c8c3482fa7fb8ed3
Parents: e7c6d81
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Jul 21 15:15:52 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Jul 21 15:15:52 2015 +0200

----------------------------------------------------------------------
 pom.xml                                              | 6 +++---
 src/main/resources/org/apache/syncope/checkstyle.xml | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/c3282665/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 994362f..8c3ac32 100644
--- a/pom.xml
+++ b/pom.xml
@@ -330,14 +330,14 @@ under the License.
 
     <camel.version>2.15.2</camel.version>	
 
-    <jackson.version>2.5.4</jackson.version>
+    <jackson.version>2.6.0</jackson.version>
 
     <spring.version>4.1.7.RELEASE</spring.version>
     <spring-security.version>4.0.1.RELEASE</spring-security.version>
 
     <openjpa.version>2.4.0</openjpa.version>
     <commons-dbcp.version>2.1</commons-dbcp.version>
-    <hibernate-validator.version>5.1.3.Final</hibernate-validator.version>
+    <hibernate-validator.version>5.2.0.Final</hibernate-validator.version>
 
     <jasypt.version>1.9.2</jasypt.version>
 
@@ -1235,7 +1235,7 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>2.15</version>
+          <version>2.16</version>
           <configuration>
             <configLocation>${rootpom.basedir}/src/main/resources/org/apache/syncope/checkstyle.xml</configLocation>
             <targetJdk>${targetJdk}</targetJdk>

http://git-wip-us.apache.org/repos/asf/syncope/blob/c3282665/src/main/resources/org/apache/syncope/checkstyle.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/syncope/checkstyle.xml b/src/main/resources/org/apache/syncope/checkstyle.xml
index 5251890..74e9d97 100644
--- a/src/main/resources/org/apache/syncope/checkstyle.xml
+++ b/src/main/resources/org/apache/syncope/checkstyle.xml
@@ -197,7 +197,6 @@ under the License.
     <module name="InnerAssignment"/>
     <!--<module name="MagicNumber"/>-->
     <module name="MissingSwitchDefault"/>
-    <module name="RedundantThrows"/>
     <module name="SimplifyBooleanExpression"/>
     <module name="SimplifyBooleanReturn"/>
 


[08/10] syncope git commit: Upgrading codemirror

Posted by il...@apache.org.
Upgrading codemirror


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/ce8d4ede
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/ce8d4ede
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/ce8d4ede

Branch: refs/heads/SYNCOPE-652
Commit: ce8d4edec7c2fbd26f14c083fd9f859c6e4f36f1
Parents: fe7fa13
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jul 23 10:55:59 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jul 23 10:55:59 2015 +0200

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/ce8d4ede/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8c3ac32..c6ec582 100644
--- a/pom.xml
+++ b/pom.xml
@@ -379,7 +379,7 @@ under the License.
     <font-awesome.version>4.3.0</font-awesome.version>
     <ionicons.version>2.0.1</ionicons.version>
     <highlightjs.version>8.4-4</highlightjs.version>
-    <codemirror.version>5.4</codemirror.version>
+    <codemirror.version>5.5</codemirror.version>
     <jsplumb.version>1.6.4</jsplumb.version>
     
     <wicket.version>7.0.0-M6</wicket.version>


[05/10] syncope git commit: [SYNCOPE-684] The StatusMod for UserMod#pwdPropRequest was not set at all from UserSelfModalPage

Posted by il...@apache.org.
[SYNCOPE-684] The StatusMod for UserMod#pwdPropRequest was not set at all from UserSelfModalPage


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/660b0ce8
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/660b0ce8
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/660b0ce8

Branch: refs/heads/master
Commit: 660b0ce88b22152e816b7c7812eb6e1bdfdc496b
Parents: 5d2817a
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jul 23 10:53:04 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jul 23 10:53:04 2015 +0200

----------------------------------------------------------------------
 .../syncope/console/pages/EditUserModalPage.java  |  6 ++----
 .../syncope/console/pages/UserModalPage.java      | 18 +++++++-----------
 .../syncope/console/pages/UserSelfModalPage.java  | 14 ++++++++++++--
 .../console/pages/UserTemplateModalPage.java      |  4 ++--
 .../syncope/console/pages/ViewUserModalPage.java  |  2 +-
 .../console/pages/panels/UserDetailsPanel.java    |  4 +---
 6 files changed, 25 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
index be9faf3..9ae618b 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
@@ -76,9 +76,8 @@ public class EditUserModalPage extends UserModalPage {
         }
     }
 
-    @SuppressWarnings("rawtypes")
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         final UserTO updatedUserTO = (UserTO) form.getModelObject();
 
         if (updatedUserTO.getId() == 0) {
@@ -97,9 +96,8 @@ public class EditUserModalPage extends UserModalPage {
         }
     }
 
-    @SuppressWarnings("rawtypes")
     @Override
-    protected void closeAction(final AjaxRequestTarget target, final Form form) {
+    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
         setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
index 9135120..faca818 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
@@ -78,8 +78,7 @@ public abstract class UserModalPage extends BaseModalPage {
         fragment.setOutputMarkupId(true);
         add(fragment);
 
-        storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword",
-                new Model<Boolean>(Boolean.TRUE));
+        storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword", new Model<Boolean>(Boolean.TRUE));
     }
 
     public UserTO getUserTO() {
@@ -90,18 +89,17 @@ public abstract class UserModalPage extends BaseModalPage {
         this.userTO = userTO;
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    protected Form setupEditPanel() {
+    protected Form<UserTO> setupEditPanel() {
         fragment.add(new Label("id", userTO.getId() == 0
                 ? ""
                 : userTO.getUsername()));
 
         fragment.add(new Label("new", userTO.getId() == 0
                 ? new ResourceModel("new")
-                : new Model("")));
+                : new Model<String>("")));
 
-        final Form form = new Form("UserForm");
-        form.setModel(new CompoundPropertyModel(userTO));
+        final Form<UserTO> form = new Form<UserTO>("UserForm");
+        form.setModel(new CompoundPropertyModel<UserTO>(userTO));
 
         //--------------------------------
         // User details
@@ -222,9 +220,7 @@ public abstract class UserModalPage extends BaseModalPage {
         };
     }
 
-    @SuppressWarnings("rawtypes")
-    protected abstract void submitAction(AjaxRequestTarget target, Form form);
+    protected abstract void submitAction(AjaxRequestTarget target, Form<?> form);
 
-    @SuppressWarnings("rawtypes")
-    protected abstract void closeAction(AjaxRequestTarget target, Form form);
+    protected abstract void closeAction(AjaxRequestTarget target, Form<?> form);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
index 9123f07..2c1407e 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
@@ -19,6 +19,8 @@
 package org.apache.syncope.console.pages;
 
 import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.mod.StatusMod;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.util.AttributableOperations;
@@ -50,7 +52,7 @@ public class UserSelfModalPage extends UserModalPage {
     }
 
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         final UserTO updatedUserTO = (UserTO) form.getModelObject();
 
         if (updatedUserTO.getId() == 0) {
@@ -58,6 +60,14 @@ public class UserSelfModalPage extends UserModalPage {
         } else {
             final UserMod userMod = AttributableOperations.diff(updatedUserTO, initialUserTO);
 
+            if (StringUtils.isNotBlank(userMod.getPassword())) {
+                StatusMod pwdPropRequest = new StatusMod();
+                pwdPropRequest.setOnSyncope(true);
+                pwdPropRequest.getResourceNames().addAll(updatedUserTO.getResources());
+
+                userMod.setPwdPropRequest(pwdPropRequest);
+            }
+
             // update user only if it has changed
             if (!userMod.isEmpty()) {
                 restClient.update(userMod);
@@ -66,7 +76,7 @@ public class UserSelfModalPage extends UserModalPage {
     }
 
     @Override
-    protected void closeAction(final AjaxRequestTarget target, final Form form) {
+    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
         setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
index 09ea426..b12a0ed 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
@@ -48,13 +48,13 @@ public class UserTemplateModalPage extends UserModalPage {
     }
 
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         syncTaskTO.setUserTemplate((UserTO) form.getModelObject());
         taskRestClient.updateSyncTask(syncTaskTO);
     }
 
     @Override
-    protected void closeAction(final AjaxRequestTarget target, final Form form) {
+    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
         window.close(target);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
index fc6f0ec..d424295 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
@@ -43,7 +43,7 @@ public class ViewUserModalPage extends EditUserModalPage {
     }
 
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         // No submit allowed, read-only form
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
index 7d30e98..d1c7cec 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
@@ -20,8 +20,6 @@ package org.apache.syncope.console.pages.panels;
 
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.console.commons.JexlHelpUtil;
-import org.apache.syncope.console.pages.UserModalPage;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
 import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
@@ -43,7 +41,7 @@ public class UserDetailsPanel extends Panel {
 
     private static final long serialVersionUID = 6592027822510220463L;
 
-    public UserDetailsPanel(final String id, final UserTO userTO, final Form form, final boolean resetPassword,
+    public UserDetailsPanel(final String id, final UserTO userTO, final Form<?> form, final boolean resetPassword,
             final boolean templateMode) {
 
         super(id);


[06/10] syncope git commit: [SYNCOPE-684] Merge from 1_2_X

Posted by il...@apache.org.
[SYNCOPE-684] Merge from 1_2_X


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/fe7fa132
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/fe7fa132
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/fe7fa132

Branch: refs/heads/SYNCOPE-652
Commit: fe7fa1324dd1ae2815c0161a0c39cfc4e9c8ba97
Parents: c328266 660b0ce
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jul 23 10:55:40 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jul 23 10:55:40 2015 +0200

----------------------------------------------------------------------
 .../client/console/pages/EditUserModalPage.java       |  6 ++----
 .../syncope/client/console/pages/UserModalPage.java   | 14 ++++++--------
 .../client/console/pages/UserSelfModalPage.java       |  9 +++++++++
 .../client/console/pages/UserTemplateModalPage.java   |  4 ++--
 .../client/console/pages/ViewUserModalPage.java       |  2 +-
 .../client/console/panels/UserDetailsPanel.java       |  2 +-
 6 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/EditUserModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/EditUserModalPage.java
index af502d2,0000000..792f3bd
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/EditUserModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/EditUserModalPage.java
@@@ -1,105 -1,0 +1,103 @@@
 +/*
 + * 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.console.pages;
 +
 +import java.util.ArrayList;
 +import org.apache.commons.lang3.SerializationUtils;
 +import org.apache.syncope.client.console.commons.Mode;
 +import org.apache.syncope.client.console.commons.status.StatusBean;
 +import org.apache.syncope.client.console.panels.AccountInformationPanel;
 +import org.apache.syncope.client.console.panels.MembershipsPanel;
 +import org.apache.syncope.client.console.panels.ResourcesPanel;
 +import org.apache.syncope.client.console.panels.StatusPanel;
 +import org.apache.syncope.common.lib.AttributableOperations;
 +import org.apache.syncope.common.lib.mod.UserMod;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.basic.Label;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.model.ResourceModel;
 +
 +/**
 + * Modal window with User form.
 + */
 +public class EditUserModalPage extends UserModalPage {
 +
 +    private static final long serialVersionUID = -6479209496805705739L;
 +
 +    protected Form form;
 +
 +    private final UserTO initialUserTO;
 +
 +    private StatusPanel statusPanel;
 +
 +    public EditUserModalPage(final PageReference pageRef, final ModalWindow window, final UserTO userTO) {
 +        super(pageRef, window, userTO, Mode.ADMIN, true);
 +
 +        this.initialUserTO = SerializationUtils.clone(userTO);
 +
 +        form = setupEditPanel();
 +
 +        // add resource assignment details in case of update
 +        if (userTO.getKey() != 0) {
 +            form.addOrReplace(new Label("pwdChangeInfo", new ResourceModel("pwdChangeInfo")));
 +
 +            statusPanel = new StatusPanel("statuspanel", userTO, new ArrayList<StatusBean>(), getPageReference());
 +            statusPanel.setOutputMarkupId(true);
 +            MetaDataRoleAuthorizationStrategy.authorize(
 +                    statusPanel, RENDER, xmlRolesReader.getEntitlement("Resources", "getConnectorObject"));
 +            form.addOrReplace(statusPanel);
 +
 +            form.addOrReplace(new AccountInformationPanel("accountinformation", userTO));
 +
 +            form.addOrReplace(new ResourcesPanel.Builder("resources").attributableTO(userTO).
 +                    statusPanel(statusPanel).build());
 +
 +            form.addOrReplace(new MembershipsPanel("memberships", userTO, mode, statusPanel, getPageReference()));
 +        }
 +    }
 +
-     @SuppressWarnings("rawtypes")
 +    @Override
-     protected void submitAction(final AjaxRequestTarget target, final Form form) {
++    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
 +        final UserTO updatedUserTO = (UserTO) form.getModelObject();
 +
 +        if (updatedUserTO.getKey() == 0) {
 +            userTO = userRestClient.create(updatedUserTO, storePassword.getModelObject());
 +        } else {
 +            final UserMod userMod = AttributableOperations.diff(updatedUserTO, initialUserTO);
 +
 +            if (statusPanel != null) {
 +                userMod.setPwdPropRequest(statusPanel.getStatusMod());
 +            }
 +
 +            // update user just if it is changed
 +            if (!userMod.isEmpty()) {
 +                userTO = userRestClient.update(initialUserTO.getETagValue(), userMod);
 +            }
 +        }
 +    }
 +
-     @SuppressWarnings("rawtypes")
 +    @Override
-     protected void closeAction(final AjaxRequestTarget target, final Form form) {
++    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
 +        setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
index 0835ca2,0000000..e549505
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
@@@ -1,229 -1,0 +1,227 @@@
 +/*
 + * 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.console.pages;
 +
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.console.commons.Constants;
 +import org.apache.syncope.client.console.commons.Mode;
 +import org.apache.syncope.client.console.panels.DerAttrsPanel;
 +import org.apache.syncope.client.console.panels.MembershipsPanel;
 +import org.apache.syncope.client.console.panels.PlainAttrsPanel;
 +import org.apache.syncope.client.console.panels.ResourcesPanel;
 +import org.apache.syncope.client.console.panels.SecurityQuestionPanel;
 +import org.apache.syncope.client.console.panels.UserDetailsPanel;
 +import org.apache.syncope.client.console.panels.VirAttrsPanel;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 +import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 +import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.basic.Label;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.markup.html.panel.Fragment;
 +import org.apache.wicket.model.CompoundPropertyModel;
 +import org.apache.wicket.model.Model;
 +import org.apache.wicket.model.ResourceModel;
 +
 +/**
 + * Modal window with User form.
 + */
 +public abstract class UserModalPage extends BaseModalPage {
 +
 +    private static final long serialVersionUID = 5002005009737457667L;
 +
 +    protected final PageReference pageRef;
 +
 +    protected final ModalWindow window;
 +
 +    protected UserTO userTO;
 +
 +    protected final Mode mode;
 +
 +    private Fragment fragment = null;
 +
 +    private final boolean resetPassword;
 +
 +    protected final AjaxCheckBoxPanel storePassword;
 +
 +    public UserModalPage(final PageReference callerPageRef, final ModalWindow window, final UserTO userTO,
 +            final Mode mode, final boolean resetPassword) {
 +
 +        super();
 +
 +        this.pageRef = callerPageRef;
 +        this.window = window;
 +        this.userTO = userTO;
 +        this.mode = mode;
 +        this.resetPassword = resetPassword;
 +
 +        fragment = new Fragment("userModalFrag", "userModalEditFrag", this);
 +        fragment.setOutputMarkupId(true);
 +        add(fragment);
 +
-         storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword",
-                 new Model<Boolean>(Boolean.TRUE));
++        storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword", new Model<Boolean>(Boolean.TRUE));
 +    }
 +
 +    public UserTO getUserTO() {
 +        return userTO;
 +    }
 +
 +    public void setUserTO(final UserTO userTO) {
 +        this.userTO = userTO;
 +    }
 +
-     @SuppressWarnings({ "unchecked", "rawtypes" })
-     protected Form setupEditPanel() {
-         fragment.add(new Label("id", userTO.getKey() == 0
++    protected Form<UserTO> setupEditPanel() {
++        fragment.add(new Label("id", userTO.getId() == 0
 +                ? StringUtils.EMPTY
 +                : userTO.getUsername()));
 +
 +        fragment.add(new Label("new", userTO.getKey() == 0
 +                ? new ResourceModel("new")
-                 : new Model(StringUtils.EMPTY)));
++                : new Model<String>(StringUtils.EMPTY)));
 +
-         final Form form = new Form("UserForm");
-         form.setModel(new CompoundPropertyModel(userTO));
++        final Form<UserTO> form = new Form<UserTO>("UserForm");
++        form.setModel(new CompoundPropertyModel<UserTO>(userTO));
 +
 +        //--------------------------------
 +        // User details
 +        //--------------------------------
 +        form.add(new UserDetailsPanel("details", userTO, form, resetPassword, mode == Mode.TEMPLATE));
 +
 +        form.add(new Label("statuspanel", ""));
 +
 +        form.add(new Label("pwdChangeInfo", ""));
 +
 +        form.add(new Label("securityQuestion", ""));
 +        form.addOrReplace(new SecurityQuestionPanel("securityQuestion", userTO));
 +
 +        form.add(new Label("accountinformation", ""));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Store password internally checkbox
 +        //--------------------------------
 +        final Fragment storePwdFragment = new Fragment("storePwdFrag", "storePwdCheck", form);
 +        storePwdFragment.setOutputMarkupId(true);
 +        final Label storePasswordLabel = new Label("storePasswordLabel", new ResourceModel("storePassword"));
 +        storePwdFragment.add(storePasswordLabel);
 +        storePwdFragment.add(storePassword);
 +        form.add(userTO.getKey() == 0 && mode != Mode.TEMPLATE
 +                ? storePwdFragment : new Fragment("storePwdFrag", "emptyFragment", form));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Attributes panel
 +        //--------------------------------
 +        form.add(new PlainAttrsPanel("plainAttrs", userTO, form, mode));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Derived attributes panel
 +        //--------------------------------
 +        form.add(new DerAttrsPanel("derAttrs", userTO));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Virtual attributes panel
 +        //--------------------------------
 +        form.add(new VirAttrsPanel("virAttrs", userTO, mode == Mode.TEMPLATE));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Resources panel
 +        //--------------------------------
 +        form.add(new ResourcesPanel.Builder("resources").attributableTO(userTO).build());
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Groups panel
 +        //--------------------------------
 +        form.add(new MembershipsPanel("memberships", userTO, mode, null, getPageReference()));
 +        //--------------------------------
 +
 +        final AjaxButton submit = getOnSubmit();
 +
 +        if (mode == Mode.ADMIN) {
 +            String allowedRoles = userTO.getKey() == 0
 +                    ? xmlRolesReader.getEntitlement("Users", "create")
 +                    : xmlRolesReader.getEntitlement("Users", "update");
 +            MetaDataRoleAuthorizationStrategy.authorize(submit, RENDER, allowedRoles);
 +        }
 +
 +        fragment.add(form);
 +        form.add(submit);
 +        form.setDefaultButton(submit);
 +
 +        final AjaxButton cancel = new AjaxButton(CANCEL, new ResourceModel(CANCEL)) {
 +
 +            private static final long serialVersionUID = 530608535790823587L;
 +
 +            @Override
 +            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
 +                window.close(target);
 +            }
 +
 +            @Override
 +            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
 +            }
 +        };
 +
 +        cancel.setDefaultFormProcessing(false);
 +        form.add(cancel);
 +
 +        return form;
 +    }
 +
 +    protected AjaxButton getOnSubmit() {
 +        return new IndicatingAjaxButton(APPLY, new ResourceModel(SUBMIT)) {
 +
 +            private static final long serialVersionUID = -958724007591692537L;
 +
 +            @Override
 +            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
 +                try {
 +                    submitAction(target, form);
 +
 +                    if (pageRef.getPage() instanceof BasePage) {
 +                        ((BasePage) pageRef.getPage()).setModalResult(true);
 +                    }
 +
 +                    closeAction(target, form);
 +                } catch (Exception e) {
 +                    LOG.error("While creating or updating user", e);
 +                    error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                    feedbackPanel.refresh(target);
 +                }
 +            }
 +
 +            @Override
 +            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
 +                feedbackPanel.refresh(target);
 +            }
 +        };
 +    }
 +
 +    protected abstract void submitAction(AjaxRequestTarget target, Form<?> form);
 +
 +    protected abstract void closeAction(AjaxRequestTarget target, Form<?> form);
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserSelfModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserSelfModalPage.java
index 087bd69,0000000..aa902c0
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserSelfModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserSelfModalPage.java
@@@ -1,72 -1,0 +1,81 @@@
 +/*
 + * 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.console.pages;
 +
 +import org.apache.commons.lang3.SerializationUtils;
 +import org.apache.syncope.client.console.commons.Mode;
 +import org.apache.syncope.client.console.rest.UserSelfRestClient;
 +import org.apache.syncope.common.lib.AttributableOperations;
 +import org.apache.syncope.common.lib.mod.UserMod;
 +import org.apache.syncope.common.lib.to.UserTO;
++import org.apache.commons.lang3.StringUtils;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.spring.injection.annot.SpringBean;
 +
 +/**
 + * Modal window with User form.
 + */
 +public class UserSelfModalPage extends UserModalPage {
 +
 +    private static final long serialVersionUID = 603212869211672852L;
 +
 +    @SpringBean
 +    private UserSelfRestClient restClient;
 +
 +    private final UserTO initialUserTO;
 +
 +    public UserSelfModalPage(final PageReference callerPageRef, final ModalWindow window, final UserTO userTO) {
 +        super(callerPageRef, window, userTO, Mode.SELF, userTO.getKey() != 0);
 +
 +        this.initialUserTO = SerializationUtils.clone(userTO);
 +        setupEditPanel();
 +    }
 +
 +    @Override
 +    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
 +        final UserTO updatedUserTO = (UserTO) form.getModelObject();
 +
 +        if (updatedUserTO.getKey() == 0) {
 +            restClient.create(updatedUserTO, storePassword.getModelObject());
 +        } else {
 +            final UserMod userMod = AttributableOperations.diff(updatedUserTO, initialUserTO);
 +
++            if (StringUtils.isNotBlank(userMod.getPassword())) {
++                StatusMod pwdPropRequest = new StatusMod();
++                pwdPropRequest.setOnSyncope(true);
++                pwdPropRequest.getResourceNames().addAll(updatedUserTO.getResources());
++
++                userMod.setPwdPropRequest(pwdPropRequest);
++            }
++
 +            // update user only if it has changed
 +            if (!userMod.isEmpty()) {
 +                restClient.update(userMod);
 +            }
 +        }
 +    }
 +
 +    @Override
 +    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
 +        setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserTemplateModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserTemplateModalPage.java
index 2b04035,0000000..5f8e36d
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserTemplateModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserTemplateModalPage.java
@@@ -1,60 -1,0 +1,60 @@@
 +/*
 + * 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.console.pages;
 +
 +import org.apache.syncope.client.console.commons.Mode;
 +import org.apache.syncope.common.lib.to.SyncTaskTO;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.form.Form;
 +
 +/**
 + * Modal window with User form.
 + */
 +public class UserTemplateModalPage extends UserModalPage {
 +
 +    private static final long serialVersionUID = 511003221213581368L;
 +
 +    private final SyncTaskTO syncTaskTO;
 +
 +    public UserTemplateModalPage(final PageReference callerPageRef, final ModalWindow window,
 +            final SyncTaskTO syncTaskTO) {
 +
 +        super(callerPageRef, window, syncTaskTO.getUserTemplate() == null
 +                ? new UserTO()
 +                : syncTaskTO.getUserTemplate(), Mode.TEMPLATE, true);
 +
 +        this.syncTaskTO = syncTaskTO;
 +
 +        setupEditPanel();
 +    }
 +
 +    @Override
-     protected void submitAction(final AjaxRequestTarget target, final Form form) {
++    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
 +        syncTaskTO.setUserTemplate((UserTO) form.getModelObject());
 +        taskRestClient.updateSyncTask(syncTaskTO);
 +    }
 +
 +    @Override
-     protected void closeAction(final AjaxRequestTarget target, final Form form) {
++    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
 +        window.close(target);
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/ViewUserModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/ViewUserModalPage.java
index d47e07f,0000000..babb6a3
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/ViewUserModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/ViewUserModalPage.java
@@@ -1,49 -1,0 +1,49 @@@
 +/*
 + * 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.console.pages;
 +
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.form.Form;
 +
 +public class ViewUserModalPage extends EditUserModalPage {
 +
 +    private static final long serialVersionUID = -8715255026876951611L;
 +
 +    public ViewUserModalPage(final PageReference callerPageRef, final ModalWindow window, final UserTO userTO) {
 +        super(callerPageRef, window, userTO);
 +        form.setEnabled(false);
 +        form.get(CANCEL).setVisible(false);
 +    }
 +
 +    @Override
 +    protected AjaxButton getOnSubmit() {
 +        AjaxButton submit = super.getOnSubmit();
 +        submit.setVisible(false);
 +        return submit;
 +    }
 +
 +    @Override
-     protected void submitAction(final AjaxRequestTarget target, final Form form) {
++    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
 +        // No submit allowed, read-only form
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
index bf990ec,0000000..b023414
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
@@@ -1,122 -1,0 +1,122 @@@
 +/*
 + * 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.console.panels;
 +
 +import org.apache.syncope.client.console.commons.JexlHelpUtils;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
 +import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.Component;
 +import org.apache.wicket.ajax.markup.html.AjaxLink;
 +import org.apache.wicket.behavior.Behavior;
 +import org.apache.wicket.markup.ComponentTag;
 +import org.apache.wicket.markup.html.WebMarkupContainer;
 +import org.apache.wicket.markup.html.basic.Label;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.markup.html.form.PasswordTextField;
 +import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator;
 +import org.apache.wicket.markup.html.panel.Panel;
 +import org.apache.wicket.model.Model;
 +import org.apache.wicket.model.PropertyModel;
 +import org.apache.wicket.model.ResourceModel;
 +
 +public class UserDetailsPanel extends Panel {
 +
 +    private static final long serialVersionUID = 6592027822510220463L;
 +
-     public UserDetailsPanel(final String id, final UserTO userTO, final Form form, final boolean resetPassword,
++    public UserDetailsPanel(final String id, final UserTO userTO, final Form<?> form, final boolean resetPassword,
 +            final boolean templateMode) {
 +
 +        super(id);
 +
 +        // ------------------------
 +        // Username
 +        // ------------------------
 +        final FieldPanel<String> username = new AjaxTextFieldPanel("username", "username",
 +                new PropertyModel<String>(userTO, "username"));
 +
 +        final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("usernameJexlHelp");
 +
 +        final AjaxLink<?> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "usernameQuestionMarkJexlHelp");
 +        add(questionMarkJexlHelp);
 +        questionMarkJexlHelp.add(jexlHelp);
 +
 +        if (!templateMode) {
 +            username.addRequiredLabel();
 +            questionMarkJexlHelp.setVisible(false);
 +        }
 +        add(username);
 +        // ------------------------
 +
 +        // ------------------------
 +        // Password
 +        // ------------------------
 +        final WebMarkupContainer pwdJexlHelp = JexlHelpUtils.getJexlHelpWebContainer("pwdJexlHelp");
 +
 +        final AjaxLink<?> pwdQuestionMarkJexlHelp = JexlHelpUtils.getAjaxLink(pwdJexlHelp, "pwdQuestionMarkJexlHelp");
 +        add(pwdQuestionMarkJexlHelp);
 +        pwdQuestionMarkJexlHelp.add(pwdJexlHelp);
 +
 +        FieldPanel<String> password;
 +        Label confirmPasswordLabel = new Label("confirmPasswordLabel", new ResourceModel("confirmPassword"));
 +        FieldPanel<String> confirmPassword;
 +        if (templateMode) {
 +            password = new AjaxTextFieldPanel("password", "password", new PropertyModel<String>(userTO, "password"));
 +
 +            confirmPasswordLabel.setVisible(false);
 +            confirmPassword = new AjaxTextFieldPanel("confirmPassword", "confirmPassword", new Model<String>());
 +            confirmPassword.setEnabled(false);
 +            confirmPassword.setVisible(false);
 +        } else {
 +            pwdQuestionMarkJexlHelp.setVisible(false);
 +
 +            password = new AjaxPasswordFieldPanel("password", "password",
 +                    new PropertyModel<String>(userTO, "password"));
 +            ((PasswordTextField) password.getField()).setResetPassword(resetPassword);
 +
 +            confirmPassword = new AjaxPasswordFieldPanel("confirmPassword", "confirmPassword", new Model<String>());
 +            if (!resetPassword) {
 +                confirmPassword.getField().setModelObject(userTO.getPassword());
 +            }
 +            ((PasswordTextField) confirmPassword.getField()).setResetPassword(resetPassword);
 +
 +            form.add(new EqualPasswordInputValidator(password.getField(), confirmPassword.getField()));
 +        }
 +        add(password);
 +        add(confirmPasswordLabel);
 +        add(confirmPassword);
 +
 +        final WebMarkupContainer mandatoryPassword = new WebMarkupContainer("mandatory_pwd");
 +        mandatoryPassword.add(new Behavior() {
 +
 +            private static final long serialVersionUID = 1469628524240283489L;
 +
 +            @Override
 +            public void onComponentTag(final Component component, final ComponentTag tag) {
 +                if (userTO.getKey() > 0) {
 +                    tag.put("style", "display:none;");
 +                }
 +            }
 +        });
 +
 +        add(mandatoryPassword);
 +        // ------------------------
 +    }
 +}


[09/10] syncope git commit: Upgrading codemirror

Posted by il...@apache.org.
Upgrading codemirror


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/ce8d4ede
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/ce8d4ede
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/ce8d4ede

Branch: refs/heads/master
Commit: ce8d4edec7c2fbd26f14c083fd9f859c6e4f36f1
Parents: fe7fa13
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jul 23 10:55:59 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jul 23 10:55:59 2015 +0200

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/ce8d4ede/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8c3ac32..c6ec582 100644
--- a/pom.xml
+++ b/pom.xml
@@ -379,7 +379,7 @@ under the License.
     <font-awesome.version>4.3.0</font-awesome.version>
     <ionicons.version>2.0.1</ionicons.version>
     <highlightjs.version>8.4-4</highlightjs.version>
-    <codemirror.version>5.4</codemirror.version>
+    <codemirror.version>5.5</codemirror.version>
     <jsplumb.version>1.6.4</jsplumb.version>
     
     <wicket.version>7.0.0-M6</wicket.version>


[07/10] syncope git commit: [SYNCOPE-684] Merge from 1_2_X

Posted by il...@apache.org.
[SYNCOPE-684] Merge from 1_2_X


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/fe7fa132
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/fe7fa132
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/fe7fa132

Branch: refs/heads/master
Commit: fe7fa1324dd1ae2815c0161a0c39cfc4e9c8ba97
Parents: c328266 660b0ce
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jul 23 10:55:40 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jul 23 10:55:40 2015 +0200

----------------------------------------------------------------------
 .../client/console/pages/EditUserModalPage.java       |  6 ++----
 .../syncope/client/console/pages/UserModalPage.java   | 14 ++++++--------
 .../client/console/pages/UserSelfModalPage.java       |  9 +++++++++
 .../client/console/pages/UserTemplateModalPage.java   |  4 ++--
 .../client/console/pages/ViewUserModalPage.java       |  2 +-
 .../client/console/panels/UserDetailsPanel.java       |  2 +-
 6 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/EditUserModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/EditUserModalPage.java
index af502d2,0000000..792f3bd
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/EditUserModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/EditUserModalPage.java
@@@ -1,105 -1,0 +1,103 @@@
 +/*
 + * 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.console.pages;
 +
 +import java.util.ArrayList;
 +import org.apache.commons.lang3.SerializationUtils;
 +import org.apache.syncope.client.console.commons.Mode;
 +import org.apache.syncope.client.console.commons.status.StatusBean;
 +import org.apache.syncope.client.console.panels.AccountInformationPanel;
 +import org.apache.syncope.client.console.panels.MembershipsPanel;
 +import org.apache.syncope.client.console.panels.ResourcesPanel;
 +import org.apache.syncope.client.console.panels.StatusPanel;
 +import org.apache.syncope.common.lib.AttributableOperations;
 +import org.apache.syncope.common.lib.mod.UserMod;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.basic.Label;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.model.ResourceModel;
 +
 +/**
 + * Modal window with User form.
 + */
 +public class EditUserModalPage extends UserModalPage {
 +
 +    private static final long serialVersionUID = -6479209496805705739L;
 +
 +    protected Form form;
 +
 +    private final UserTO initialUserTO;
 +
 +    private StatusPanel statusPanel;
 +
 +    public EditUserModalPage(final PageReference pageRef, final ModalWindow window, final UserTO userTO) {
 +        super(pageRef, window, userTO, Mode.ADMIN, true);
 +
 +        this.initialUserTO = SerializationUtils.clone(userTO);
 +
 +        form = setupEditPanel();
 +
 +        // add resource assignment details in case of update
 +        if (userTO.getKey() != 0) {
 +            form.addOrReplace(new Label("pwdChangeInfo", new ResourceModel("pwdChangeInfo")));
 +
 +            statusPanel = new StatusPanel("statuspanel", userTO, new ArrayList<StatusBean>(), getPageReference());
 +            statusPanel.setOutputMarkupId(true);
 +            MetaDataRoleAuthorizationStrategy.authorize(
 +                    statusPanel, RENDER, xmlRolesReader.getEntitlement("Resources", "getConnectorObject"));
 +            form.addOrReplace(statusPanel);
 +
 +            form.addOrReplace(new AccountInformationPanel("accountinformation", userTO));
 +
 +            form.addOrReplace(new ResourcesPanel.Builder("resources").attributableTO(userTO).
 +                    statusPanel(statusPanel).build());
 +
 +            form.addOrReplace(new MembershipsPanel("memberships", userTO, mode, statusPanel, getPageReference()));
 +        }
 +    }
 +
-     @SuppressWarnings("rawtypes")
 +    @Override
-     protected void submitAction(final AjaxRequestTarget target, final Form form) {
++    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
 +        final UserTO updatedUserTO = (UserTO) form.getModelObject();
 +
 +        if (updatedUserTO.getKey() == 0) {
 +            userTO = userRestClient.create(updatedUserTO, storePassword.getModelObject());
 +        } else {
 +            final UserMod userMod = AttributableOperations.diff(updatedUserTO, initialUserTO);
 +
 +            if (statusPanel != null) {
 +                userMod.setPwdPropRequest(statusPanel.getStatusMod());
 +            }
 +
 +            // update user just if it is changed
 +            if (!userMod.isEmpty()) {
 +                userTO = userRestClient.update(initialUserTO.getETagValue(), userMod);
 +            }
 +        }
 +    }
 +
-     @SuppressWarnings("rawtypes")
 +    @Override
-     protected void closeAction(final AjaxRequestTarget target, final Form form) {
++    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
 +        setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
index 0835ca2,0000000..e549505
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserModalPage.java
@@@ -1,229 -1,0 +1,227 @@@
 +/*
 + * 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.console.pages;
 +
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.console.commons.Constants;
 +import org.apache.syncope.client.console.commons.Mode;
 +import org.apache.syncope.client.console.panels.DerAttrsPanel;
 +import org.apache.syncope.client.console.panels.MembershipsPanel;
 +import org.apache.syncope.client.console.panels.PlainAttrsPanel;
 +import org.apache.syncope.client.console.panels.ResourcesPanel;
 +import org.apache.syncope.client.console.panels.SecurityQuestionPanel;
 +import org.apache.syncope.client.console.panels.UserDetailsPanel;
 +import org.apache.syncope.client.console.panels.VirAttrsPanel;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 +import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 +import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.basic.Label;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.markup.html.panel.Fragment;
 +import org.apache.wicket.model.CompoundPropertyModel;
 +import org.apache.wicket.model.Model;
 +import org.apache.wicket.model.ResourceModel;
 +
 +/**
 + * Modal window with User form.
 + */
 +public abstract class UserModalPage extends BaseModalPage {
 +
 +    private static final long serialVersionUID = 5002005009737457667L;
 +
 +    protected final PageReference pageRef;
 +
 +    protected final ModalWindow window;
 +
 +    protected UserTO userTO;
 +
 +    protected final Mode mode;
 +
 +    private Fragment fragment = null;
 +
 +    private final boolean resetPassword;
 +
 +    protected final AjaxCheckBoxPanel storePassword;
 +
 +    public UserModalPage(final PageReference callerPageRef, final ModalWindow window, final UserTO userTO,
 +            final Mode mode, final boolean resetPassword) {
 +
 +        super();
 +
 +        this.pageRef = callerPageRef;
 +        this.window = window;
 +        this.userTO = userTO;
 +        this.mode = mode;
 +        this.resetPassword = resetPassword;
 +
 +        fragment = new Fragment("userModalFrag", "userModalEditFrag", this);
 +        fragment.setOutputMarkupId(true);
 +        add(fragment);
 +
-         storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword",
-                 new Model<Boolean>(Boolean.TRUE));
++        storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword", new Model<Boolean>(Boolean.TRUE));
 +    }
 +
 +    public UserTO getUserTO() {
 +        return userTO;
 +    }
 +
 +    public void setUserTO(final UserTO userTO) {
 +        this.userTO = userTO;
 +    }
 +
-     @SuppressWarnings({ "unchecked", "rawtypes" })
-     protected Form setupEditPanel() {
-         fragment.add(new Label("id", userTO.getKey() == 0
++    protected Form<UserTO> setupEditPanel() {
++        fragment.add(new Label("id", userTO.getId() == 0
 +                ? StringUtils.EMPTY
 +                : userTO.getUsername()));
 +
 +        fragment.add(new Label("new", userTO.getKey() == 0
 +                ? new ResourceModel("new")
-                 : new Model(StringUtils.EMPTY)));
++                : new Model<String>(StringUtils.EMPTY)));
 +
-         final Form form = new Form("UserForm");
-         form.setModel(new CompoundPropertyModel(userTO));
++        final Form<UserTO> form = new Form<UserTO>("UserForm");
++        form.setModel(new CompoundPropertyModel<UserTO>(userTO));
 +
 +        //--------------------------------
 +        // User details
 +        //--------------------------------
 +        form.add(new UserDetailsPanel("details", userTO, form, resetPassword, mode == Mode.TEMPLATE));
 +
 +        form.add(new Label("statuspanel", ""));
 +
 +        form.add(new Label("pwdChangeInfo", ""));
 +
 +        form.add(new Label("securityQuestion", ""));
 +        form.addOrReplace(new SecurityQuestionPanel("securityQuestion", userTO));
 +
 +        form.add(new Label("accountinformation", ""));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Store password internally checkbox
 +        //--------------------------------
 +        final Fragment storePwdFragment = new Fragment("storePwdFrag", "storePwdCheck", form);
 +        storePwdFragment.setOutputMarkupId(true);
 +        final Label storePasswordLabel = new Label("storePasswordLabel", new ResourceModel("storePassword"));
 +        storePwdFragment.add(storePasswordLabel);
 +        storePwdFragment.add(storePassword);
 +        form.add(userTO.getKey() == 0 && mode != Mode.TEMPLATE
 +                ? storePwdFragment : new Fragment("storePwdFrag", "emptyFragment", form));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Attributes panel
 +        //--------------------------------
 +        form.add(new PlainAttrsPanel("plainAttrs", userTO, form, mode));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Derived attributes panel
 +        //--------------------------------
 +        form.add(new DerAttrsPanel("derAttrs", userTO));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Virtual attributes panel
 +        //--------------------------------
 +        form.add(new VirAttrsPanel("virAttrs", userTO, mode == Mode.TEMPLATE));
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Resources panel
 +        //--------------------------------
 +        form.add(new ResourcesPanel.Builder("resources").attributableTO(userTO).build());
 +        //--------------------------------
 +
 +        //--------------------------------
 +        // Groups panel
 +        //--------------------------------
 +        form.add(new MembershipsPanel("memberships", userTO, mode, null, getPageReference()));
 +        //--------------------------------
 +
 +        final AjaxButton submit = getOnSubmit();
 +
 +        if (mode == Mode.ADMIN) {
 +            String allowedRoles = userTO.getKey() == 0
 +                    ? xmlRolesReader.getEntitlement("Users", "create")
 +                    : xmlRolesReader.getEntitlement("Users", "update");
 +            MetaDataRoleAuthorizationStrategy.authorize(submit, RENDER, allowedRoles);
 +        }
 +
 +        fragment.add(form);
 +        form.add(submit);
 +        form.setDefaultButton(submit);
 +
 +        final AjaxButton cancel = new AjaxButton(CANCEL, new ResourceModel(CANCEL)) {
 +
 +            private static final long serialVersionUID = 530608535790823587L;
 +
 +            @Override
 +            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
 +                window.close(target);
 +            }
 +
 +            @Override
 +            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
 +            }
 +        };
 +
 +        cancel.setDefaultFormProcessing(false);
 +        form.add(cancel);
 +
 +        return form;
 +    }
 +
 +    protected AjaxButton getOnSubmit() {
 +        return new IndicatingAjaxButton(APPLY, new ResourceModel(SUBMIT)) {
 +
 +            private static final long serialVersionUID = -958724007591692537L;
 +
 +            @Override
 +            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
 +                try {
 +                    submitAction(target, form);
 +
 +                    if (pageRef.getPage() instanceof BasePage) {
 +                        ((BasePage) pageRef.getPage()).setModalResult(true);
 +                    }
 +
 +                    closeAction(target, form);
 +                } catch (Exception e) {
 +                    LOG.error("While creating or updating user", e);
 +                    error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                    feedbackPanel.refresh(target);
 +                }
 +            }
 +
 +            @Override
 +            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
 +                feedbackPanel.refresh(target);
 +            }
 +        };
 +    }
 +
 +    protected abstract void submitAction(AjaxRequestTarget target, Form<?> form);
 +
 +    protected abstract void closeAction(AjaxRequestTarget target, Form<?> form);
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserSelfModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserSelfModalPage.java
index 087bd69,0000000..aa902c0
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserSelfModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserSelfModalPage.java
@@@ -1,72 -1,0 +1,81 @@@
 +/*
 + * 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.console.pages;
 +
 +import org.apache.commons.lang3.SerializationUtils;
 +import org.apache.syncope.client.console.commons.Mode;
 +import org.apache.syncope.client.console.rest.UserSelfRestClient;
 +import org.apache.syncope.common.lib.AttributableOperations;
 +import org.apache.syncope.common.lib.mod.UserMod;
 +import org.apache.syncope.common.lib.to.UserTO;
++import org.apache.commons.lang3.StringUtils;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.spring.injection.annot.SpringBean;
 +
 +/**
 + * Modal window with User form.
 + */
 +public class UserSelfModalPage extends UserModalPage {
 +
 +    private static final long serialVersionUID = 603212869211672852L;
 +
 +    @SpringBean
 +    private UserSelfRestClient restClient;
 +
 +    private final UserTO initialUserTO;
 +
 +    public UserSelfModalPage(final PageReference callerPageRef, final ModalWindow window, final UserTO userTO) {
 +        super(callerPageRef, window, userTO, Mode.SELF, userTO.getKey() != 0);
 +
 +        this.initialUserTO = SerializationUtils.clone(userTO);
 +        setupEditPanel();
 +    }
 +
 +    @Override
 +    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
 +        final UserTO updatedUserTO = (UserTO) form.getModelObject();
 +
 +        if (updatedUserTO.getKey() == 0) {
 +            restClient.create(updatedUserTO, storePassword.getModelObject());
 +        } else {
 +            final UserMod userMod = AttributableOperations.diff(updatedUserTO, initialUserTO);
 +
++            if (StringUtils.isNotBlank(userMod.getPassword())) {
++                StatusMod pwdPropRequest = new StatusMod();
++                pwdPropRequest.setOnSyncope(true);
++                pwdPropRequest.getResourceNames().addAll(updatedUserTO.getResources());
++
++                userMod.setPwdPropRequest(pwdPropRequest);
++            }
++
 +            // update user only if it has changed
 +            if (!userMod.isEmpty()) {
 +                restClient.update(userMod);
 +            }
 +        }
 +    }
 +
 +    @Override
 +    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
 +        setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserTemplateModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserTemplateModalPage.java
index 2b04035,0000000..5f8e36d
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserTemplateModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/UserTemplateModalPage.java
@@@ -1,60 -1,0 +1,60 @@@
 +/*
 + * 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.console.pages;
 +
 +import org.apache.syncope.client.console.commons.Mode;
 +import org.apache.syncope.common.lib.to.SyncTaskTO;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.form.Form;
 +
 +/**
 + * Modal window with User form.
 + */
 +public class UserTemplateModalPage extends UserModalPage {
 +
 +    private static final long serialVersionUID = 511003221213581368L;
 +
 +    private final SyncTaskTO syncTaskTO;
 +
 +    public UserTemplateModalPage(final PageReference callerPageRef, final ModalWindow window,
 +            final SyncTaskTO syncTaskTO) {
 +
 +        super(callerPageRef, window, syncTaskTO.getUserTemplate() == null
 +                ? new UserTO()
 +                : syncTaskTO.getUserTemplate(), Mode.TEMPLATE, true);
 +
 +        this.syncTaskTO = syncTaskTO;
 +
 +        setupEditPanel();
 +    }
 +
 +    @Override
-     protected void submitAction(final AjaxRequestTarget target, final Form form) {
++    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
 +        syncTaskTO.setUserTemplate((UserTO) form.getModelObject());
 +        taskRestClient.updateSyncTask(syncTaskTO);
 +    }
 +
 +    @Override
-     protected void closeAction(final AjaxRequestTarget target, final Form form) {
++    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
 +        window.close(target);
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/pages/ViewUserModalPage.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/pages/ViewUserModalPage.java
index d47e07f,0000000..babb6a3
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/pages/ViewUserModalPage.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/pages/ViewUserModalPage.java
@@@ -1,49 -1,0 +1,49 @@@
 +/*
 + * 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.console.pages;
 +
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.html.form.Form;
 +
 +public class ViewUserModalPage extends EditUserModalPage {
 +
 +    private static final long serialVersionUID = -8715255026876951611L;
 +
 +    public ViewUserModalPage(final PageReference callerPageRef, final ModalWindow window, final UserTO userTO) {
 +        super(callerPageRef, window, userTO);
 +        form.setEnabled(false);
 +        form.get(CANCEL).setVisible(false);
 +    }
 +
 +    @Override
 +    protected AjaxButton getOnSubmit() {
 +        AjaxButton submit = super.getOnSubmit();
 +        submit.setVisible(false);
 +        return submit;
 +    }
 +
 +    @Override
-     protected void submitAction(final AjaxRequestTarget target, final Form form) {
++    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
 +        // No submit allowed, read-only form
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/fe7fa132/client/old_console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
----------------------------------------------------------------------
diff --cc client/old_console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
index bf990ec,0000000..b023414
mode 100644,000000..100644
--- a/client/old_console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
+++ b/client/old_console/src/main/java/org/apache/syncope/client/console/panels/UserDetailsPanel.java
@@@ -1,122 -1,0 +1,122 @@@
 +/*
 + * 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.console.panels;
 +
 +import org.apache.syncope.client.console.commons.JexlHelpUtils;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
 +import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.wicket.Component;
 +import org.apache.wicket.ajax.markup.html.AjaxLink;
 +import org.apache.wicket.behavior.Behavior;
 +import org.apache.wicket.markup.ComponentTag;
 +import org.apache.wicket.markup.html.WebMarkupContainer;
 +import org.apache.wicket.markup.html.basic.Label;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.markup.html.form.PasswordTextField;
 +import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator;
 +import org.apache.wicket.markup.html.panel.Panel;
 +import org.apache.wicket.model.Model;
 +import org.apache.wicket.model.PropertyModel;
 +import org.apache.wicket.model.ResourceModel;
 +
 +public class UserDetailsPanel extends Panel {
 +
 +    private static final long serialVersionUID = 6592027822510220463L;
 +
-     public UserDetailsPanel(final String id, final UserTO userTO, final Form form, final boolean resetPassword,
++    public UserDetailsPanel(final String id, final UserTO userTO, final Form<?> form, final boolean resetPassword,
 +            final boolean templateMode) {
 +
 +        super(id);
 +
 +        // ------------------------
 +        // Username
 +        // ------------------------
 +        final FieldPanel<String> username = new AjaxTextFieldPanel("username", "username",
 +                new PropertyModel<String>(userTO, "username"));
 +
 +        final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("usernameJexlHelp");
 +
 +        final AjaxLink<?> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "usernameQuestionMarkJexlHelp");
 +        add(questionMarkJexlHelp);
 +        questionMarkJexlHelp.add(jexlHelp);
 +
 +        if (!templateMode) {
 +            username.addRequiredLabel();
 +            questionMarkJexlHelp.setVisible(false);
 +        }
 +        add(username);
 +        // ------------------------
 +
 +        // ------------------------
 +        // Password
 +        // ------------------------
 +        final WebMarkupContainer pwdJexlHelp = JexlHelpUtils.getJexlHelpWebContainer("pwdJexlHelp");
 +
 +        final AjaxLink<?> pwdQuestionMarkJexlHelp = JexlHelpUtils.getAjaxLink(pwdJexlHelp, "pwdQuestionMarkJexlHelp");
 +        add(pwdQuestionMarkJexlHelp);
 +        pwdQuestionMarkJexlHelp.add(pwdJexlHelp);
 +
 +        FieldPanel<String> password;
 +        Label confirmPasswordLabel = new Label("confirmPasswordLabel", new ResourceModel("confirmPassword"));
 +        FieldPanel<String> confirmPassword;
 +        if (templateMode) {
 +            password = new AjaxTextFieldPanel("password", "password", new PropertyModel<String>(userTO, "password"));
 +
 +            confirmPasswordLabel.setVisible(false);
 +            confirmPassword = new AjaxTextFieldPanel("confirmPassword", "confirmPassword", new Model<String>());
 +            confirmPassword.setEnabled(false);
 +            confirmPassword.setVisible(false);
 +        } else {
 +            pwdQuestionMarkJexlHelp.setVisible(false);
 +
 +            password = new AjaxPasswordFieldPanel("password", "password",
 +                    new PropertyModel<String>(userTO, "password"));
 +            ((PasswordTextField) password.getField()).setResetPassword(resetPassword);
 +
 +            confirmPassword = new AjaxPasswordFieldPanel("confirmPassword", "confirmPassword", new Model<String>());
 +            if (!resetPassword) {
 +                confirmPassword.getField().setModelObject(userTO.getPassword());
 +            }
 +            ((PasswordTextField) confirmPassword.getField()).setResetPassword(resetPassword);
 +
 +            form.add(new EqualPasswordInputValidator(password.getField(), confirmPassword.getField()));
 +        }
 +        add(password);
 +        add(confirmPasswordLabel);
 +        add(confirmPassword);
 +
 +        final WebMarkupContainer mandatoryPassword = new WebMarkupContainer("mandatory_pwd");
 +        mandatoryPassword.add(new Behavior() {
 +
 +            private static final long serialVersionUID = 1469628524240283489L;
 +
 +            @Override
 +            public void onComponentTag(final Component component, final ComponentTag tag) {
 +                if (userTO.getKey() > 0) {
 +                    tag.put("style", "display:none;");
 +                }
 +            }
 +        });
 +
 +        add(mandatoryPassword);
 +        // ------------------------
 +    }
 +}


[10/10] syncope git commit: Merge branch 'master' into SYNCOPE-652

Posted by il...@apache.org.
Merge branch 'master' into SYNCOPE-652


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d1bd87ad
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d1bd87ad
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d1bd87ad

Branch: refs/heads/SYNCOPE-652
Commit: d1bd87ad9e7a3b6d7a27133fdd69fa7007a2ab7d
Parents: d8b71cc ce8d4ed
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jul 23 10:56:15 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jul 23 10:56:15 2015 +0200

----------------------------------------------------------------------
 .../client/console/pages/EditUserModalPage.java       |  6 ++----
 .../syncope/client/console/pages/UserModalPage.java   | 14 ++++++--------
 .../client/console/pages/UserSelfModalPage.java       |  9 +++++++++
 .../client/console/pages/UserTemplateModalPage.java   |  4 ++--
 .../client/console/pages/ViewUserModalPage.java       |  2 +-
 .../client/console/panels/UserDetailsPanel.java       |  2 +-
 pom.xml                                               |  2 +-
 7 files changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/d1bd87ad/pom.xml
----------------------------------------------------------------------


[02/10] syncope git commit: Merge branch 'master' into SYNCOPE-652

Posted by il...@apache.org.
Merge branch 'master' into SYNCOPE-652


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d8b71ccb
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d8b71ccb
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d8b71ccb

Branch: refs/heads/SYNCOPE-652
Commit: d8b71ccb965ff5672249acfc11a6bfefd9aeb4b3
Parents: a6cf6a6 c328266
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Jul 21 15:31:08 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Jul 21 15:31:08 2015 +0200

----------------------------------------------------------------------
 pom.xml                                              | 6 +++---
 src/main/resources/org/apache/syncope/checkstyle.xml | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/d8b71ccb/pom.xml
----------------------------------------------------------------------


[04/10] syncope git commit: [SYNCOPE-684] The StatusMod for UserMod#pwdPropRequest was not set at all from UserSelfModalPage

Posted by il...@apache.org.
[SYNCOPE-684] The StatusMod for UserMod#pwdPropRequest was not set at all from UserSelfModalPage


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/660b0ce8
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/660b0ce8
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/660b0ce8

Branch: refs/heads/SYNCOPE-652
Commit: 660b0ce88b22152e816b7c7812eb6e1bdfdc496b
Parents: 5d2817a
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jul 23 10:53:04 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jul 23 10:53:04 2015 +0200

----------------------------------------------------------------------
 .../syncope/console/pages/EditUserModalPage.java  |  6 ++----
 .../syncope/console/pages/UserModalPage.java      | 18 +++++++-----------
 .../syncope/console/pages/UserSelfModalPage.java  | 14 ++++++++++++--
 .../console/pages/UserTemplateModalPage.java      |  4 ++--
 .../syncope/console/pages/ViewUserModalPage.java  |  2 +-
 .../console/pages/panels/UserDetailsPanel.java    |  4 +---
 6 files changed, 25 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
index be9faf3..9ae618b 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
@@ -76,9 +76,8 @@ public class EditUserModalPage extends UserModalPage {
         }
     }
 
-    @SuppressWarnings("rawtypes")
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         final UserTO updatedUserTO = (UserTO) form.getModelObject();
 
         if (updatedUserTO.getId() == 0) {
@@ -97,9 +96,8 @@ public class EditUserModalPage extends UserModalPage {
         }
     }
 
-    @SuppressWarnings("rawtypes")
     @Override
-    protected void closeAction(final AjaxRequestTarget target, final Form form) {
+    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
         setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
index 9135120..faca818 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
@@ -78,8 +78,7 @@ public abstract class UserModalPage extends BaseModalPage {
         fragment.setOutputMarkupId(true);
         add(fragment);
 
-        storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword",
-                new Model<Boolean>(Boolean.TRUE));
+        storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword", new Model<Boolean>(Boolean.TRUE));
     }
 
     public UserTO getUserTO() {
@@ -90,18 +89,17 @@ public abstract class UserModalPage extends BaseModalPage {
         this.userTO = userTO;
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    protected Form setupEditPanel() {
+    protected Form<UserTO> setupEditPanel() {
         fragment.add(new Label("id", userTO.getId() == 0
                 ? ""
                 : userTO.getUsername()));
 
         fragment.add(new Label("new", userTO.getId() == 0
                 ? new ResourceModel("new")
-                : new Model("")));
+                : new Model<String>("")));
 
-        final Form form = new Form("UserForm");
-        form.setModel(new CompoundPropertyModel(userTO));
+        final Form<UserTO> form = new Form<UserTO>("UserForm");
+        form.setModel(new CompoundPropertyModel<UserTO>(userTO));
 
         //--------------------------------
         // User details
@@ -222,9 +220,7 @@ public abstract class UserModalPage extends BaseModalPage {
         };
     }
 
-    @SuppressWarnings("rawtypes")
-    protected abstract void submitAction(AjaxRequestTarget target, Form form);
+    protected abstract void submitAction(AjaxRequestTarget target, Form<?> form);
 
-    @SuppressWarnings("rawtypes")
-    protected abstract void closeAction(AjaxRequestTarget target, Form form);
+    protected abstract void closeAction(AjaxRequestTarget target, Form<?> form);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
index 9123f07..2c1407e 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
@@ -19,6 +19,8 @@
 package org.apache.syncope.console.pages;
 
 import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.mod.StatusMod;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.util.AttributableOperations;
@@ -50,7 +52,7 @@ public class UserSelfModalPage extends UserModalPage {
     }
 
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         final UserTO updatedUserTO = (UserTO) form.getModelObject();
 
         if (updatedUserTO.getId() == 0) {
@@ -58,6 +60,14 @@ public class UserSelfModalPage extends UserModalPage {
         } else {
             final UserMod userMod = AttributableOperations.diff(updatedUserTO, initialUserTO);
 
+            if (StringUtils.isNotBlank(userMod.getPassword())) {
+                StatusMod pwdPropRequest = new StatusMod();
+                pwdPropRequest.setOnSyncope(true);
+                pwdPropRequest.getResourceNames().addAll(updatedUserTO.getResources());
+
+                userMod.setPwdPropRequest(pwdPropRequest);
+            }
+
             // update user only if it has changed
             if (!userMod.isEmpty()) {
                 restClient.update(userMod);
@@ -66,7 +76,7 @@ public class UserSelfModalPage extends UserModalPage {
     }
 
     @Override
-    protected void closeAction(final AjaxRequestTarget target, final Form form) {
+    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
         setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
index 09ea426..b12a0ed 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
@@ -48,13 +48,13 @@ public class UserTemplateModalPage extends UserModalPage {
     }
 
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         syncTaskTO.setUserTemplate((UserTO) form.getModelObject());
         taskRestClient.updateSyncTask(syncTaskTO);
     }
 
     @Override
-    protected void closeAction(final AjaxRequestTarget target, final Form form) {
+    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
         window.close(target);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
index fc6f0ec..d424295 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
@@ -43,7 +43,7 @@ public class ViewUserModalPage extends EditUserModalPage {
     }
 
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         // No submit allowed, read-only form
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
index 7d30e98..d1c7cec 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
@@ -20,8 +20,6 @@ package org.apache.syncope.console.pages.panels;
 
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.console.commons.JexlHelpUtil;
-import org.apache.syncope.console.pages.UserModalPage;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
 import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
@@ -43,7 +41,7 @@ public class UserDetailsPanel extends Panel {
 
     private static final long serialVersionUID = 6592027822510220463L;
 
-    public UserDetailsPanel(final String id, final UserTO userTO, final Form form, final boolean resetPassword,
+    public UserDetailsPanel(final String id, final UserTO userTO, final Form<?> form, final boolean resetPassword,
             final boolean templateMode) {
 
         super(id);


[03/10] syncope git commit: [SYNCOPE-684] The StatusMod for UserMod#pwdPropRequest was not set at all from UserSelfModalPage

Posted by il...@apache.org.
[SYNCOPE-684] The StatusMod for UserMod#pwdPropRequest was not set at all from UserSelfModalPage


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/660b0ce8
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/660b0ce8
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/660b0ce8

Branch: refs/heads/1_2_X
Commit: 660b0ce88b22152e816b7c7812eb6e1bdfdc496b
Parents: 5d2817a
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jul 23 10:53:04 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jul 23 10:53:04 2015 +0200

----------------------------------------------------------------------
 .../syncope/console/pages/EditUserModalPage.java  |  6 ++----
 .../syncope/console/pages/UserModalPage.java      | 18 +++++++-----------
 .../syncope/console/pages/UserSelfModalPage.java  | 14 ++++++++++++--
 .../console/pages/UserTemplateModalPage.java      |  4 ++--
 .../syncope/console/pages/ViewUserModalPage.java  |  2 +-
 .../console/pages/panels/UserDetailsPanel.java    |  4 +---
 6 files changed, 25 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
index be9faf3..9ae618b 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
@@ -76,9 +76,8 @@ public class EditUserModalPage extends UserModalPage {
         }
     }
 
-    @SuppressWarnings("rawtypes")
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         final UserTO updatedUserTO = (UserTO) form.getModelObject();
 
         if (updatedUserTO.getId() == 0) {
@@ -97,9 +96,8 @@ public class EditUserModalPage extends UserModalPage {
         }
     }
 
-    @SuppressWarnings("rawtypes")
     @Override
-    protected void closeAction(final AjaxRequestTarget target, final Form form) {
+    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
         setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
index 9135120..faca818 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
@@ -78,8 +78,7 @@ public abstract class UserModalPage extends BaseModalPage {
         fragment.setOutputMarkupId(true);
         add(fragment);
 
-        storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword",
-                new Model<Boolean>(Boolean.TRUE));
+        storePassword = new AjaxCheckBoxPanel("storePassword", "storePassword", new Model<Boolean>(Boolean.TRUE));
     }
 
     public UserTO getUserTO() {
@@ -90,18 +89,17 @@ public abstract class UserModalPage extends BaseModalPage {
         this.userTO = userTO;
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    protected Form setupEditPanel() {
+    protected Form<UserTO> setupEditPanel() {
         fragment.add(new Label("id", userTO.getId() == 0
                 ? ""
                 : userTO.getUsername()));
 
         fragment.add(new Label("new", userTO.getId() == 0
                 ? new ResourceModel("new")
-                : new Model("")));
+                : new Model<String>("")));
 
-        final Form form = new Form("UserForm");
-        form.setModel(new CompoundPropertyModel(userTO));
+        final Form<UserTO> form = new Form<UserTO>("UserForm");
+        form.setModel(new CompoundPropertyModel<UserTO>(userTO));
 
         //--------------------------------
         // User details
@@ -222,9 +220,7 @@ public abstract class UserModalPage extends BaseModalPage {
         };
     }
 
-    @SuppressWarnings("rawtypes")
-    protected abstract void submitAction(AjaxRequestTarget target, Form form);
+    protected abstract void submitAction(AjaxRequestTarget target, Form<?> form);
 
-    @SuppressWarnings("rawtypes")
-    protected abstract void closeAction(AjaxRequestTarget target, Form form);
+    protected abstract void closeAction(AjaxRequestTarget target, Form<?> form);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
index 9123f07..2c1407e 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserSelfModalPage.java
@@ -19,6 +19,8 @@
 package org.apache.syncope.console.pages;
 
 import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.mod.StatusMod;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.util.AttributableOperations;
@@ -50,7 +52,7 @@ public class UserSelfModalPage extends UserModalPage {
     }
 
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         final UserTO updatedUserTO = (UserTO) form.getModelObject();
 
         if (updatedUserTO.getId() == 0) {
@@ -58,6 +60,14 @@ public class UserSelfModalPage extends UserModalPage {
         } else {
             final UserMod userMod = AttributableOperations.diff(updatedUserTO, initialUserTO);
 
+            if (StringUtils.isNotBlank(userMod.getPassword())) {
+                StatusMod pwdPropRequest = new StatusMod();
+                pwdPropRequest.setOnSyncope(true);
+                pwdPropRequest.getResourceNames().addAll(updatedUserTO.getResources());
+
+                userMod.setPwdPropRequest(pwdPropRequest);
+            }
+
             // update user only if it has changed
             if (!userMod.isEmpty()) {
                 restClient.update(userMod);
@@ -66,7 +76,7 @@ public class UserSelfModalPage extends UserModalPage {
     }
 
     @Override
-    protected void closeAction(final AjaxRequestTarget target, final Form form) {
+    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
         setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
index 09ea426..b12a0ed 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserTemplateModalPage.java
@@ -48,13 +48,13 @@ public class UserTemplateModalPage extends UserModalPage {
     }
 
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         syncTaskTO.setUserTemplate((UserTO) form.getModelObject());
         taskRestClient.updateSyncTask(syncTaskTO);
     }
 
     @Override
-    protected void closeAction(final AjaxRequestTarget target, final Form form) {
+    protected void closeAction(final AjaxRequestTarget target, final Form<?> form) {
         window.close(target);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
index fc6f0ec..d424295 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
@@ -43,7 +43,7 @@ public class ViewUserModalPage extends EditUserModalPage {
     }
 
     @Override
-    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+    protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
         // No submit allowed, read-only form
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/660b0ce8/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
index 7d30e98..d1c7cec 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
@@ -20,8 +20,6 @@ package org.apache.syncope.console.pages.panels;
 
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.console.commons.JexlHelpUtil;
-import org.apache.syncope.console.pages.UserModalPage;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
 import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
@@ -43,7 +41,7 @@ public class UserDetailsPanel extends Panel {
 
     private static final long serialVersionUID = 6592027822510220463L;
 
-    public UserDetailsPanel(final String id, final UserTO userTO, final Form form, final boolean resetPassword,
+    public UserDetailsPanel(final String id, final UserTO userTO, final Form<?> form, final boolean resetPassword,
             final boolean templateMode) {
 
         super(id);