You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by mm...@apache.org on 2020/01/30 19:48:54 UTC
[syncope] branch 2_1_X updated: SYNCOPE-1511: only show history
management action menu when wizard is in modal mode (#163)
This is an automated email from the ASF dual-hosted git repository.
mmoayyed pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/2_1_X by this push:
new 84d4941 SYNCOPE-1511: only show history management action menu when wizard is in modal mode (#163)
84d4941 is described below
commit 84d4941e461a4bdeb098afdc133a67405d9ad6c8
Author: Misagh Moayyed <mm...@gmail.com>
AuthorDate: Thu Jan 30 23:48:47 2020 +0400
SYNCOPE-1511: only show history management action menu when wizard is in modal mode (#163)
---
.../client/console/panels/UserDirectoryPanel.java | 105 +++++++++++----------
1 file changed, 53 insertions(+), 52 deletions(-)
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
index f1fcfee..11092ef 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
@@ -344,58 +344,59 @@ public class UserDirectoryPanel extends AnyDirectoryPanel<UserTO, UserRestClient
StandardEntitlement.RESOURCE_GET_CONNOBJECT));
}
- panel.add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -1978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- model.setObject(restClient.read(model.getObject().getKey()));
- target.add(altDefaultModal.setContent(new AuditHistoryModal<UserTO>(
- altDefaultModal,
- AuditElements.EventCategoryType.LOGIC,
- "UserLogic",
- model.getObject(),
- StandardEntitlement.USER_UPDATE,
- pageRef) {
-
- private static final long serialVersionUID = 959378158400669867L;
-
- @Override
- protected void restore(final String json, final AjaxRequestTarget target) {
- // The original audit record masks the password and the security
- // answer; so we cannot use the audit record to resurrect the entry based on mask data.
- //
- // The method behavior below will reset the audit record such that the current security
- // answer and the password for the object are always maintained, and such properties for the
- // user cannot be restored using audit records.
- UserTO original = model.getObject();
- try {
- UserTO updated = MAPPER.readValue(json, UserTO.class);
- UserPatch userPatch = AnyOperations.diff(updated, original, false);
- userPatch.setPassword(null);
- userPatch.setSecurityAnswer(null);
- ProvisioningResult<UserTO> result = restClient.update(original.getETagValue(), userPatch);
- model.getObject().setLastChangeDate(result.getEntity().getLastChangeDate());
-
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
- target.add(container);
- } catch (Exception e) {
- LOG.error("While restoring user {}", model.getObject().getKey(), e);
- SyncopeConsoleSession.get().onException(e);
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- }));
-
- altDefaultModal.header(new Model<>(
- getString("auditHistory.title", new Model<>(new AnyWrapper<>(model.getObject())))));
-
- altDefaultModal.show(true);
- }
- }, ActionType.VIEW_AUDIT_HISTORY,
- String.format("%s,%s", StandardEntitlement.USER_READ, StandardEntitlement.AUDIT_LIST)).
- setRealms(realm, model.getObject().getDynRealms());
+ if (wizardInModal) {
+ panel.add(new ActionLink<UserTO>() {
+ private static final long serialVersionUID = -1978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ model.setObject(restClient.read(model.getObject().getKey()));
+ target.add(altDefaultModal.setContent(new AuditHistoryModal<UserTO>(
+ altDefaultModal,
+ AuditElements.EventCategoryType.LOGIC,
+ "UserLogic",
+ model.getObject(),
+ StandardEntitlement.USER_UPDATE,
+ pageRef) {
+
+ private static final long serialVersionUID = 959378158400669867L;
+
+ @Override
+ protected void restore(final String json, final AjaxRequestTarget target) {
+ // The original audit record masks the password and the security
+ // answer; so we cannot use the audit record to resurrect the entry based on mask data.
+ //
+ // The method behavior below will reset the audit record such that the current security
+ // answer and the password for the object are always maintained, and such properties for the
+ // user cannot be restored using audit records.
+ UserTO original = model.getObject();
+ try {
+ UserTO updated = MAPPER.readValue(json, UserTO.class);
+ UserPatch userPatch = AnyOperations.diff(updated, original, false);
+ userPatch.setPassword(null);
+ userPatch.setSecurityAnswer(null);
+ ProvisioningResult<UserTO> result = restClient.update(original.getETagValue(), userPatch);
+ model.getObject().setLastChangeDate(result.getEntity().getLastChangeDate());
+
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (Exception e) {
+ LOG.error("While restoring user {}", model.getObject().getKey(), e);
+ SyncopeConsoleSession.get().onException(e);
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
+ }));
+
+ altDefaultModal.header(new Model<>(
+ getString("auditHistory.title", new Model<>(new AnyWrapper<>(model.getObject())))));
+
+ altDefaultModal.show(true);
+ }
+ }, ActionType.VIEW_AUDIT_HISTORY,
+ String.format("%s,%s", StandardEntitlement.USER_READ, StandardEntitlement.AUDIT_LIST)).
+ setRealms(realm, model.getObject().getDynRealms());
+ }
panel.add(new ActionLink<UserTO>() {