public static String defaultConsoleLayoutInfoIfEmpty(final String content, final List<String> anyTypes) { String result; if (StringUtils.isBlank(content)) { try { ObjectNode tree = MAPPER.createObjectNode(); tree.set(AnyTypeKind.USER.name(), MAPPER.valueToTree(new UserFormLayoutInfo())); tree.set(AnyTypeKind.GROUP.name(), MAPPER.valueToTree(new GroupFormLayoutInfo())); for (String anyType : anyTypes) { if (!anyType.equals(AnyTypeKind.USER.name()) && !anyType.equals(AnyTypeKind.GROUP.name())) { tree.set(anyType, MAPPER.valueToTree(new AnyObjectFormLayoutInfo())); } } result = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(tree); } catch (IOException e) { throw new IllegalArgumentException("While generating default console layout info for " + SyncopeConsoleSession.get().getSelfTO().getUsername(), e); } } else { try { result = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(MAPPER.readTree(content)); } catch (IOException e) { result = content; } } return result; }
@Override public Class<? extends Page> getHomePage() { return AuthenticatedWebSession.get().isSignedIn() && SyncopeConsoleSession.get().getSelfTO().isMustChangePassword() ? MustChangePassword.class : Dashboard.class; }
public static Triple<UserFormLayoutInfo, GroupFormLayoutInfo, Map<String, AnyObjectFormLayoutInfo>> fetch( final Collection<String> anyTypes) { List<String> ownedRoles = SyncopeConsoleSession.get().getSelfTO().getRoles(); try { JsonNode tree = null; } catch (IOException e) { throw new IllegalArgumentException("While parsing console layout info for " + SyncopeConsoleSession.get().getSelfTO().getUsername(), e);
@Override protected void onSubmit(final AjaxRequestTarget target) { try { restClient.changePassword(passwordField.getModelObject()); SyncopeConsoleSession.get().invalidate(); setResponsePage(getApplication().getHomePage()); } catch (Exception e) { LOG.error("While changing password for {}", SyncopeConsoleSession.get().getSelfTO().getUsername(), e); SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage()); notificationPanel.refresh(target); } }
form.setOutputMarkupId(true); usernameField = new TextField<>("username", new Model<>(SyncopeConsoleSession.get().getSelfTO().getUsername())); usernameField.setMarkupId("username"); usernameField.setEnabled(false);
body.add(new Label("username", SyncopeConsoleSession.get().getSelfTO().getUsername()));