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:34 UTC
[07/10] syncope git commit: [SYNCOPE-684] Merge from 1_2_X
[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);
+ // ------------------------
+ }
+}