Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jan 23, 2024
2 parents e46c8d1 + 4f8742d commit 4362396
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 8 deletions.
19 changes: 19 additions & 0 deletions docs/roles-policies/role-governance.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
= Role Governance
:page-midpoint-feature: role-governance
:page-documentation-type: intro
:page-alias: { "parent" : "/midpoint/features/current/" }
:page-upkeep-status: red

NOTE: Work in progress

Lorem ipsum.
Role has owners ... and approvers.
We can set up approval policies ... and authorizations.
Policy rules, policy rules must be there.
Dolor sit amen.

== See Also

* xref:/midpoint/reference/roles-policies/policy-rules/[Policy Rules]

* xref:/midpoint/reference/concepts/object-lifecycle/[Object Lifecycle]
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
<div class="popover-inner">
<div>
<ul class="list-group">
<ul class="list-group" wicket:id="validationItemsParent">
<li class="list-group-item py-1" wicket:id="validationItems" style="display: flex; border: none !important;">
<div wicket:id="validationItem"></div>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
Expand All @@ -25,6 +26,7 @@
public class PasswordLimitationsPanel extends BasePanel<List<StringLimitationResult>> {

private static final String ID_VALIDATION_CONTAINER = "validationContainer";
private static final String ID_VALIDATION_ITEMS_PARENT = "validationItemsParent";
private static final String ID_VALIDATION_ITEMS = "validationItems";
private static final String ID_VALIDATION_ITEM = "validationItem";

Expand All @@ -51,6 +53,11 @@ public boolean isVisible() {
validationContainer.setOutputMarkupPlaceholderTag(true);
add(validationContainer);

WebMarkupContainer validationItemsParent = new WebMarkupContainer(ID_VALIDATION_ITEMS_PARENT);
validationItemsParent.setOutputMarkupId(true);
validationItemsParent.add(AttributeAppender.append("class", showInTwoColumns() ? "d-flex flex-wrap flex-row" : ""));
validationContainer.add(validationItemsParent);

ListView<StringLimitationResult> validationItems = new ListView<>(ID_VALIDATION_ITEMS, getModel()) {

private static final long serialVersionUID = 1L;
Expand All @@ -60,15 +67,19 @@ protected void populateItem(ListItem<StringLimitationResult> item) {
StringLimitationPanel limitationPanel = new StringLimitationPanel(ID_VALIDATION_ITEM, item.getModel());
limitationPanel.setOutputMarkupId(true);
item.add(limitationPanel);
item.add(AttributeModifier.append("class", (IModel<String>) () -> Boolean.TRUE.equals(item.getModelObject().isSuccess()) ? " text-success" : " text-danger"));
item.add(AttributeAppender.append("class", showInTwoColumns() ? "col-xxl-6 col-xl-12" : ""));
item.add(AttributeModifier.append("class", (IModel<String>) () -> Boolean.TRUE.equals(item.getModelObject().isSuccess()) ? " text-success" : " text-danger"));
}
};
validationItems.setOutputMarkupId(true);
validationContainer.add(validationItems);
validationItemsParent.add(validationItems);
}

public void refreshItems(AjaxRequestTarget target){
target.add(PasswordLimitationsPanel.this.get(ID_VALIDATION_CONTAINER));
}

protected boolean showInTwoColumns() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ protected List<StringLimitationResult> load() {
}
};

PasswordLimitationsPanel passwordLimitationsPanel = new PasswordLimitationsPanel(ID_PASSWORD_VALIDATION_PANEL, limitationsModel);
PasswordLimitationsPanel passwordLimitationsPanel = createLimitationPanel(ID_PASSWORD_VALIDATION_PANEL, limitationsModel);
passwordLimitationsPanel.add(new VisibleBehaviour(() -> !isPasswordLimitationPopupVisible()));
passwordLimitationsPanel.setOutputMarkupId(true);
add(passwordLimitationsPanel);
Expand Down Expand Up @@ -222,6 +222,10 @@ public void onSubmit(AjaxRequestTarget target) {

}

protected PasswordLimitationsPanel createLimitationPanel(String id, IModel<List<StringLimitationResult>> limitationsModel) {
return new PasswordLimitationsPanel(id, limitationsModel);
}

protected String getChangePasswordButtonStyle() {
return CHANGE_PASSWORD_BUTTON_STYLE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.component.LabelWithHelpPanel;
import com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel;
import com.evolveum.midpoint.gui.api.component.password.PasswordLimitationsPanel;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
Expand Down Expand Up @@ -75,7 +76,7 @@ public class PropagatePasswordPanel<F extends FocusType> extends ChangePasswordP
private static final String ID_INDIVIDUAL_SYSTEMS_CONTAINER = "individualSystemsContainer";
private static final String ID_INDIVIDUAL_SYSTEMS_TABLE = "individualSystemsTable";

private boolean propagatePassword = false;
private Boolean propagatePassword;
private boolean showResultInTable = false;
ListDataProvider<PasswordAccountDto> provider = null;

Expand All @@ -86,9 +87,18 @@ public PropagatePasswordPanel(String id, IModel<F> focusModel) {
@Override
protected void onInitialize() {
super.onInitialize();
initPropagatePasswordDefault();
initLayout();
}

private void initPropagatePasswordDefault() {
if (propagatePassword == null) {
CredentialsPropagationUserControlType propagationUserControl = getCredentialsPropagationUserControl();
propagatePassword = propagationUserControl == CredentialsPropagationUserControlType.IDENTITY_MANAGER_MANDATORY
|| propagationUserControl == CredentialsPropagationUserControlType.USER_CHOICE;
}
}

private void initLayout() {
CheckBoxPanel propagatePasswordCheckbox = new CheckBoxPanel(ID_PROPAGATE_PASSWORD_CHECKBOX, Model.of(propagatePassword),
createStringResource("ChangePasswordPanel.changePasswordOnIndividualSystems")) {
Expand Down Expand Up @@ -615,4 +625,14 @@ protected CredentialsPropagationUserControlType getCredentialsPropagationUserCon
private BoxedTablePanel<PasswordAccountDto> getTableComponent() {
return (BoxedTablePanel<PasswordAccountDto>) get(createComponentPath(ID_INDIVIDUAL_SYSTEMS_CONTAINER, ID_INDIVIDUAL_SYSTEMS_TABLE));
}

@Override
protected PasswordLimitationsPanel createLimitationPanel(String id, IModel<List<StringLimitationResult>> limitationsModel) {
return new PasswordLimitationsPanel(id, limitationsModel) {
@Override
protected boolean showInTwoColumns() {
return true;
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import java.io.Serial;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -116,6 +118,7 @@ protected void onClickPerformed(AjaxRequestTarget target, ListGroupMenuItem item
@Override
protected void onUpdate(AjaxRequestTarget target) {
onSelectionUpdate(target, selectionModel.getObject());
target.add(RoleOfTeammateMenuPanel.this.get(createComponentPath(ID_CONTAINER, ID_INPUT)));
}
});
container.add(select);
Expand Down Expand Up @@ -172,6 +175,8 @@ public static class ObjectReferenceProvider extends ChoiceProvider<ObjectReferen

@Serial private static final long serialVersionUID = 1L;

private Map<String, String> mapOidToName = new HashMap<>();

private final RoleOfTeammateMenuPanel<?> panel;

public ObjectReferenceProvider(RoleOfTeammateMenuPanel<?> panel) {
Expand Down Expand Up @@ -227,11 +232,17 @@ public void query(String text, int page, Response<ObjectReferenceType> response)
try {
List<PrismObject<UserType>> objects = WebModelServiceUtils.searchObjects(UserType.class, query, result, panel.getPageBase());

mapOidToName.clear();

response.addAll(objects.stream()
.map(o -> new ObjectReferenceType()
.map(o -> {
String name = WebComponentUtil.getDisplayNameOrName(o);
mapOidToName.put(o.getOid(), name);
return new ObjectReferenceType()
.oid(o.getOid())
.type(UserType.COMPLEX_TYPE)
.targetName(WebComponentUtil.getDisplayNameOrName(o))).collect(Collectors.toList()));
.targetName(name);
}).collect(Collectors.toList()));
} catch (Exception ex) {
LOGGER.debug("Couldn't search users for multiselect", ex);
}
Expand All @@ -242,7 +253,9 @@ public Collection<ObjectReferenceType> toChoices(Collection<String> collection)
return collection.stream()
.map(oid -> new ObjectReferenceType()
.oid(oid)
.type(UserType.COMPLEX_TYPE)).collect(Collectors.toList());
.type(UserType.COMPLEX_TYPE)
.targetName(mapOidToName.containsKey(oid) ? mapOidToName.get(oid) : null))
.collect(Collectors.toList());
}
}
}

0 comments on commit 4362396

Please sign in to comment.