Skip to content

Commit

Permalink
[SYNCOPE-1851] Further fixes for date fields in Macro forms
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgrosso committed Jan 10, 2025
1 parent ab0e7d0 commit 20014a4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.syncope.client.ui.commons.MapChoiceRenderer;
import org.apache.syncope.client.ui.commons.markup.html.form.AbstractFieldPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateFieldPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateTimeFieldPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel;
Expand Down Expand Up @@ -95,7 +96,8 @@ public void setObject(final Boolean object) {
FastDateFormat formatter = StringUtils.isBlank(prop.getDatePattern())
? FastDateFormat.getInstance()
: FastDateFormat.getInstance(prop.getDatePattern());
field = new AjaxDateTimeFieldPanel("value", label, new PropertyModel<>(prop, "value") {

PropertyModel<Date> dateModel = new PropertyModel<>(prop, "value") {

private static final long serialVersionUID = -3743432456095828573L;

Expand All @@ -115,7 +117,13 @@ public Date getObject() {
public void setObject(final Date object) {
Optional.ofNullable(object).ifPresent(date -> prop.setValue(formatter.format(date)));
}
}, formatter);
};

if (StringUtils.containsIgnoreCase(prop.getDatePattern(), "H")) {
field = new AjaxDateTimeFieldPanel("value", label, dateModel, formatter);
} else {
field = new AjaxDateFieldPanel("value", label, dateModel, formatter);
}
break;

case Enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,16 @@ public String update(final String username, final SAML2SP4UIIdP idp, final SAML2
userUR = action.beforeUpdate(userUR, loginResponse);
}

Pair<UserUR, List<PropagationStatus>> updated =
provisioningManager.update(userUR, false, userTO.getUsername(), SAML2SP_CONTEXT);
userTO = binder.getUserTO(updated.getLeft().getKey());

for (SAML2SP4UIIdPActions action : actions) {
userTO = action.afterUpdate(userTO, loginResponse);
if (userUR.isEmpty()) {
LOG.debug("No actual changes to apply for {}, ignoring", userTO.getUsername());
} else {
Pair<UserUR, List<PropagationStatus>> updated =
provisioningManager.update(userUR, false, userTO.getUsername(), SAML2SP_CONTEXT);
userTO = binder.getUserTO(updated.getLeft().getKey());

for (SAML2SP4UIIdPActions action : actions) {
userTO = action.afterUpdate(userTO, loginResponse);
}
}

return userTO.getUsername();
Expand Down

0 comments on commit 20014a4

Please sign in to comment.