Skip to content

Commit

Permalink
fix for 9546 SelfService Credentials propagationUserControl=identityM…
Browse files Browse the repository at this point in the history
…anagerMandatory
  • Loading branch information
KaterynaHonchar committed Mar 28, 2024
1 parent 5e7131e commit dcd222b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private boolean isPasswordPropagationEnabled(PasswordAccountDto passwordAccountD
private List<IColumn<PasswordAccountDto, String>> initColumns() {
List<IColumn<PasswordAccountDto, String>> columns = new ArrayList<>();

columns.add(new CheckBoxHeaderColumn<>() {
columns.add(new CheckBoxHeaderColumn<PasswordAccountDto>() {
@Override
protected IModel<Boolean> getEnabled(IModel<PasswordAccountDto> rowModel) {
return () -> {
Expand Down Expand Up @@ -301,6 +301,14 @@ protected void onUpdateRow(Item<ICellPopulator<PasswordAccountDto>> cellItem, Aj
});
}
}

@Override
protected boolean shouldBeUnchangeable(PasswordAccountDto obj) {
if (obj == null) {
return super.shouldBeUnchangeable(obj);
}
return isMandatoryPropagation(obj);
}
});

columns.add(new AbstractColumn<PasswordAccountDto, String>(createStringResource("ChangePasswordPanel.name")) {
Expand Down Expand Up @@ -617,7 +625,7 @@ protected void updateResultColumnOfTable(AjaxRequestTarget target) {
});
}

protected CredentialsPropagationUserControlType getCredentialsPropagationUserControl() {
private CredentialsPropagationUserControlType getCredentialsPropagationUserControl() {
CredentialsPolicyType credentialsPolicy = credentialsPolicyModel.getObject();
return credentialsPolicy != null && credentialsPolicy.getPassword() != null ?
credentialsPolicy.getPassword().getPropagationUserControl() : null;
Expand All @@ -644,4 +652,10 @@ protected boolean showInTwoColumns() {
protected boolean isHintPanelVisible() {
return getPasswordHintConfigurability() == PasswordHintConfigurabilityType.ALWAYS_CONFIGURE;
}

private boolean isMandatoryPropagation(PasswordAccountDto passwordAccountDto) {
CredentialsPropagationUserControlType propagationUserControl = getCredentialsPropagationUserControl();
return passwordAccountDto.isMidpoint()
&& CredentialsPropagationUserControlType.IDENTITY_MANAGER_MANDATORY.equals(propagationUserControl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ protected void onUpdateHeader(AjaxRequestTarget target, boolean selected, DataTa
for (IModel<T> object : objects) {
T modelObject = object.getObject();

if (shouldBeUnchangeable(modelObject)) {
continue;
}

if (modelObject instanceof SelectableRow) {
((SelectableRow<?>) modelObject).setSelected(selected);
} else if (modelObject instanceof SelectableObjectModel) { //TODO is this needed?
Expand Down Expand Up @@ -191,4 +195,8 @@ public void component(IsolatedCheckBoxPanel object, IVisit<IsolatedCheckBoxPanel

return ret;
}

protected boolean shouldBeUnchangeable(T modelObject) {
return false;
}
}

0 comments on commit dcd222b

Please sign in to comment.