Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/upgrade-pro…
Browse files Browse the repository at this point in the history
…cess
  • Loading branch information
1azyman committed Jun 15, 2023
2 parents a2f122a + 2684b67 commit c03c7cd
Show file tree
Hide file tree
Showing 63 changed files with 1,481 additions and 792 deletions.
16 changes: 9 additions & 7 deletions gui/admin-gui/src/frontend/scss/midpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,17 @@ body.custom-hold-transition {
}

& > a.custom-logo {
height: 3.5rem;
max-height: 3.5rem;

& > img {
vertical-align: middle;
max-height: 1.5rem;
object-fit: contain;
max-width: 100%;
width: 100%;
height: 100%;
}
vertical-align: middle;
max-height: 3.5rem;
object-fit: contain;
max-width: 100%;
width: 100%;
height: 100%;
}
}

& > .sidebar > nav > ul.nav-sidebar > li.nav-item > a.active {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<body>
<wicket:panel>
<wicket:enclosure child="menu">
<a class="brand-link custom-logo border-bottom-0" wicket:id="customLogo">
<a class="brand-link custom-logo border-bottom-0 py-0" wicket:id="customLogo">
<i wicket:id="customLogoImgCss"/>
<img wicket:id="customLogoImgSrc"/>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
import java.util.stream.Collectors;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipal;

import com.evolveum.midpoint.web.page.admin.resources.PageResourceTemplates;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -52,6 +48,7 @@
import com.evolveum.midpoint.model.api.authentication.CompiledDashboardType;
import com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile;
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;
import com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipal;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.prism.query.builder.S_FilterEntryOrEmpty;
import com.evolveum.midpoint.schema.result.OperationResult;
Expand All @@ -76,6 +73,7 @@
import com.evolveum.midpoint.web.page.admin.reports.PageCreatedReports;
import com.evolveum.midpoint.web.page.admin.resources.PageConnectorHosts;
import com.evolveum.midpoint.web.page.admin.resources.PageImportResource;
import com.evolveum.midpoint.web.page.admin.resources.PageResourceTemplates;
import com.evolveum.midpoint.web.page.admin.server.PageNodes;
import com.evolveum.midpoint.web.page.admin.server.PageTasksCertScheduling;
import com.evolveum.midpoint.web.page.admin.workflow.PageAttorneySelection;
Expand Down Expand Up @@ -185,6 +183,21 @@ public void onClick(AjaxRequestTarget target) {
logo.add(AttributeAppender.append("class", () -> WebComponentUtil.getMidPointSkin().getNavbarCss()));
add(logo);

IModel<IconType> logoModel = new IModel<>() {

private static final long serialVersionUID = 1L;

@Override
public IconType getObject() {
DeploymentInformationType info = MidPointApplication.get().getDeploymentInfo();
if (info == null | info.getLogo() == null) {
return new IconType();
}

return info.getLogo();
}
};

AjaxLink<String> customLogo = new AjaxLink<>(ID_CUSTOM_LOGO) {
private static final long serialVersionUID = 1L;

Expand All @@ -196,41 +209,27 @@ public void onClick(AjaxRequestTarget target) {
}
};
customLogo.add(AttributeAppender.append("class", () -> WebComponentUtil.getMidPointSkin().getNavbarCss()));
customLogo.add(AttributeAppender.append("class", () -> {
IconType icon = logoModel.getObject();
return StringUtils.isNotEmpty(icon.getImageUrl()) ? logoModel.getObject().getCssClass() : null;
}));
customLogo.add(new VisibleBehaviour(() -> isCustomLogoVisible()));
add(customLogo);

IModel<IconType> logoModel = new IModel<>() {

private static final long serialVersionUID = 1L;

@Override
public IconType getObject() {
DeploymentInformationType info = MidPointApplication.get().getDeploymentInfo();
return info != null ? info.getLogo() : null;
}
};

ExternalImage customLogoImgSrc = new ExternalImage(ID_CUSTOM_LOGO_IMG_SRC) {

@Override
protected void buildSrcAttribute(ComponentTag tag, IModel<?> srcModel) {
tag.put("src", WebComponentUtil.getIconUrlModel(logoModel.getObject()).getObject());
}
};
customLogoImgSrc.add(new VisibleBehaviour(() -> logoModel.getObject() != null && StringUtils.isEmpty(logoModel.getObject().getCssClass())));
customLogoImgSrc.add(new VisibleBehaviour(() -> StringUtils.isNotEmpty(logoModel.getObject().getImageUrl())));
customLogo.add(customLogoImgSrc);

WebMarkupContainer customLogoImgCss = new WebMarkupContainer(ID_CUSTOM_LOGO_IMG_CSS);
customLogoImgCss.add(new VisibleBehaviour(() -> logoModel.getObject() != null && StringUtils.isNotEmpty(logoModel.getObject().getCssClass())));
customLogoImgCss.add(new AttributeAppender("class", new IModel<String>() {

private static final long serialVersionUID = 1L;

@Override
public String getObject() {
return logoModel.getObject() != null ? logoModel.getObject().getCssClass() : null;
}
}));
customLogoImgCss.add(new VisibleBehaviour(() ->
StringUtils.isEmpty(logoModel.getObject().getImageUrl()) && StringUtils.isNotEmpty(logoModel.getObject().getCssClass())));
customLogoImgCss.add(AttributeAppender.append("class", () -> logoModel.getObject().getCssClass()));
customLogo.add(customLogoImgCss);

logo.add(PageBase.createHeaderColorStyleModel(false));
Expand Down Expand Up @@ -410,7 +409,7 @@ private MainMenuItem createResourcesItems() {
createBasicAssignmentHolderMenuItems(resourceMenu, PageTypes.RESOURCE);

resourceMenu.addMenuItemAtIndex(new MenuItem("PageAdmin.menu.top.resource.templates.list",
GuiStyleConstants.CLASS_OBJECT_RESOURCE_ICON, PageResourceTemplates.class),1);
GuiStyleConstants.CLASS_OBJECT_RESOURCE_ICON, PageResourceTemplates.class), 1);

resourceMenu.addMenuItem(new MenuItem("PageAdmin.menu.top.resources.import", PageImportResource.class));
resourceMenu.addMenuItem(new MenuItem("PageAdmin.menu.top.connectorHosts.list", PageConnectorHosts.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.schema.DeltaConvertor;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.result.OperationResultStatus;
import com.evolveum.midpoint.task.api.Task;
Expand Down Expand Up @@ -262,9 +263,11 @@ private String createRealMarksList(ProcessedObject<?> obj) {
return null;
}

PrismObject<ShadowType> shadow = WebModelServiceUtils.loadObject(new ObjectReferenceType()
.type(ShadowType.COMPLEX_TYPE)
.oid(obj.getOid()), getPageBase());
PageBase page = getPageBase();
Task task = page.getPageTask();

PrismObject<ShadowType> shadow = WebModelServiceUtils.loadObject(ShadowType.class, obj.getOid(),
GetOperationOptions.createRawCollection(), page, task, task.getResult());
if (shadow == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

import org.jetbrains.annotations.NotNull;

/** Externally-imposed exception from application of some clauses. */
public interface ClauseApplicabilityPredicate {

boolean test(@NotNull SelectorClause clause, @NotNull ClauseMatchingContext ctx);
boolean test(@NotNull SelectorClause clause, @NotNull SelectorProcessingContext ctx);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@

import org.jetbrains.annotations.NotNull;

/** TODO */
/** Description of the processing context, mainly for tracing and error reporting. */
public interface ClauseProcessingContextDescription {

/** Short identifier, mainly for trace records. */
@NotNull String getId();

/** Human-readable explanation of the context. */
@NotNull String getText();

/**
* Creates a description for embedded (child) processing context.
*
* It is assumed that its ID and text will be somehow derived from the original one plus a "delta", provided here.
*/
@NotNull ClauseProcessingContextDescription child(@NotNull String idDelta, @NotNull String textDelta);

static ClauseProcessingContextDescription defaultOne() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import com.evolveum.midpoint.schema.selector.eval.SubjectedEvaluationContext.DelegatorSelection;

import com.evolveum.midpoint.schema.traces.details.ProcessingTracer;
import com.evolveum.midpoint.util.annotation.Experimental;

import org.jetbrains.annotations.NotNull;
Expand All @@ -18,13 +19,18 @@
import com.evolveum.midpoint.schema.selector.spec.SelectorClause;
import com.evolveum.midpoint.schema.selector.spec.ValueSelector;

import static com.evolveum.midpoint.schema.selector.eval.SelectorTraceEvent.*;

/**
* Keeps everything needed to produce a filter from given clause.
* Keeps everything needed to produce a filter from given selector and clause.
*
* Most probably will be simplified in the future.
*
* @see ValueSelector#toFilter(FilteringContext)
* @see SelectorClause#toFilter(FilteringContext)
*/
@Experimental
public class ClauseFilteringContext extends ClauseMatchingContext {
public class FilteringContext extends SelectorProcessingContext {

/** The object/value type we are searching for. */
@NotNull private final Class<?> filterType;
Expand All @@ -35,22 +41,26 @@ public class ClauseFilteringContext extends ClauseMatchingContext {
/** If we are adding the selector-generated filter to the original one, here it is. */
@Nullable private final ObjectFilter originalFilter;

/** TODO ... */
/** TODO explain and revise the use of this (not sure about its exact form) */
private final boolean maySkipOnSearch;

/**
* Externally-imposed constraint on the applicability of selected clauses.
* (Used to e.g. turn off evaluation of `self` clauses in some contexts.)
*/
@Nullable private final ClauseApplicabilityPredicate clauseApplicabilityPredicate;

@NotNull final FilterCollector filterCollector;

public ClauseFilteringContext(
public FilteringContext(
@NotNull Class<?> filterType,
@NotNull Class<?> restrictedType,
@Nullable ObjectFilter originalFilter,
boolean maySkipOnSearch,
@Nullable ClauseApplicabilityPredicate clauseApplicabilityPredicate,
@NotNull FilterCollector filterCollector,
@Nullable ObjectFilterExpressionEvaluator filterEvaluator,
@NotNull SelectorProcessingTracer tracer,
@NotNull ProcessingTracer<SelectorTraceEvent> tracer,
@NotNull OrgTreeEvaluator orgTreeEvaluator,
@Nullable SubjectedEvaluationContext subjectedEvaluationContext,
@Nullable OwnerResolver ownerResolver,
Expand Down Expand Up @@ -96,21 +106,21 @@ public void addConjunct(@NotNull SelectorClause clause, ObjectFilter conjunct, S
private void traceConjunctAdded(@NotNull SelectorClause clause, ObjectFilter conjunct, String message, Object... arguments) {
if (tracer.isEnabled()) {
tracer.trace(
new TraceEvent.ConjunctAdded(clause, conjunct, message, arguments, this));
new ConjunctAdded(clause, conjunct, message, arguments, this));
}
}

public void traceFilterProcessingStart(@NotNull ValueSelector selector) {
if (tracer.isEnabled()) {
tracer.trace(
new TraceEvent.FilterProcessingStarted(selector, this));
new FilterProcessingStarted(selector, this));
}
}

public void traceFilterProcessingEnd(ValueSelector selector, boolean matched) {
if (tracer.isEnabled()) {
tracer.trace(
new TraceEvent.FilterProcessingFinished(selector, matched, this));
new FilterProcessingFinished(selector, matched, this));
}
}

Expand All @@ -126,13 +136,19 @@ public boolean maySkipOnSearch() {
return maySkipOnSearch;
}

public @NotNull ClauseFilteringContext next(
/**
* Creates a sub-context when evaluating embedded selector (e.g. `assignee`).
*
* @see MatchingContext#child(String, String)
* @see MatchingContext#child(DelegatorSelection, String, String)
*/
public @NotNull FilteringContext child(
@NotNull Class<?> filterType,
@NotNull FilterCollector filterCollector,
@Nullable ObjectFilter originalFilter,
@NotNull String idDelta,
@NotNull String textDelta) {
return new ClauseFilteringContext(
return new FilteringContext(
filterType,
filterType,
originalFilter,
Expand All @@ -150,6 +166,7 @@ public boolean maySkipOnSearch() {
}

public boolean isClauseApplicable(SelectorClause clause) {
return clauseApplicabilityPredicate == null || clauseApplicabilityPredicate.test(clause, this);
return clauseApplicabilityPredicate == null
|| clauseApplicabilityPredicate.test(clause, this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (C) 2010-2023 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.schema.selector.eval;

import com.evolveum.midpoint.prism.PrismValue;
import com.evolveum.midpoint.schema.selector.spec.SelectorClause;
import com.evolveum.midpoint.schema.selector.spec.ValueSelector;

import com.evolveum.midpoint.schema.traces.details.ProcessingTracer;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import static com.evolveum.midpoint.schema.selector.eval.SubjectedEvaluationContext.*;

/**
* Context for matching a value against a selector or clause.
*
* @see ValueSelector#matches(PrismValue, MatchingContext)
* @see SelectorClause#matches(PrismValue, MatchingContext)
*/
public class MatchingContext extends SelectorProcessingContext {

public MatchingContext(
@Nullable ObjectFilterExpressionEvaluator filterEvaluator,
@NotNull ProcessingTracer<SelectorTraceEvent> tracer,
@NotNull OrgTreeEvaluator orgTreeEvaluator,
@Nullable SubjectedEvaluationContext subjectedEvaluationContext,
@Nullable OwnerResolver ownerResolver,
@Nullable ObjectResolver objectResolver,
@NotNull ClauseProcessingContextDescription description,
@NotNull DelegatorSelection delegatorSelection) {
super(
filterEvaluator,
tracer,
orgTreeEvaluator,
subjectedEvaluationContext,
ownerResolver,
objectResolver,
description,
delegatorSelection);
}

public @NotNull MatchingContext child(
@NotNull DelegatorSelection delegatorSelection, @NotNull String idDelta, @NotNull String textDelta) {
return new MatchingContext(
filterEvaluator,
tracer,
orgTreeEvaluator,
subjectedEvaluationContext,
ownerResolver,
objectResolver,
description.child(idDelta, textDelta),
delegatorSelection);
}

public @NotNull MatchingContext child(@NotNull String idDelta, @NotNull String textDelta) {
return new MatchingContext(
filterEvaluator,
tracer,
orgTreeEvaluator,
subjectedEvaluationContext,
ownerResolver,
objectResolver,
description.child(idDelta, textDelta),
delegatorSelection);
}
}

0 comments on commit c03c7cd

Please sign in to comment.