Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Jun 23, 2023
2 parents 692f2ea + 3279556 commit ee926a5
Show file tree
Hide file tree
Showing 308 changed files with 8,702 additions and 2,757 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@
<key>failed</key>
<label>Failed</label>
</row>
<row>
<key>suspended</key>
<label>Suspended</label>
</row>

</lookupTable>
6 changes: 3 additions & 3 deletions config/sql/native-new/postgres-new-audit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ EXCEPTION WHEN duplicate_object THEN raise notice 'Main repo custom types alread
CREATE TYPE AuditEventTypeType AS ENUM ('GET_OBJECT', 'ADD_OBJECT', 'MODIFY_OBJECT',
'DELETE_OBJECT', 'EXECUTE_CHANGES_RAW', 'SYNCHRONIZATION', 'CREATE_SESSION',
'TERMINATE_SESSION', 'WORK_ITEM', 'WORKFLOW_PROCESS_INSTANCE', 'RECONCILIATION',
'SUSPEND_TASK', 'RESUME_TASK', 'RUN_TASK_IMMEDIATELY');
'SUSPEND_TASK', 'RESUME_TASK', 'RUN_TASK_IMMEDIATELY', 'DISCOVER_OBJECT');

CREATE TYPE AuditEventStageType AS ENUM ('REQUEST', 'EXECUTION');
CREATE TYPE AuditEventStageType AS ENUM ('REQUEST', 'EXECUTION', 'RESOURCE');

CREATE TYPE ChangeType AS ENUM ('ADD', 'MODIFY', 'DELETE');
-- endregion
Expand Down Expand Up @@ -352,4 +352,4 @@ limit 50;

-- Initializing the last change number used in postgres-new-upgrade.sql.
-- This is important to avoid applying any change more than once.
call apply_audit_change(3, $$ SELECT 1 $$, true);
call apply_audit_change(4, $$ SELECT 1 $$, true);
7 changes: 7 additions & 0 deletions config/sql/native-new/postgres-new-upgrade-audit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ call apply_audit_change(3, $aa$
ALTER TYPE ObjectType ADD VALUE IF NOT EXISTS 'MARK' AFTER 'LOOKUP_TABLE';
$aa$);

-- changes for 4.8
-- Shadow auditing
call apply_audit_change(4, $aa$
ALTER TYPE AuditEventStageType ADD VALUE IF NOT EXISTS 'RESOURCE' AFTER 'EXECUTION';
ALTER TYPE AuditEventTypeType ADD VALUE IF NOT EXISTS 'DISCOVER_OBJECT' AFTER 'RUN_TASK_IMMEDIATELY';
$aa$);

-- WRITE CHANGES ABOVE ^^
-- IMPORTANT: update apply_audit_change number at the end of postgres-new-audit.sql
-- to match the number used in the last change here!
1 change: 1 addition & 0 deletions gui/admin-gui/src/frontend/scss/icon-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ i.icon-basic-layer-for-column {
top: 6%;
left: 0;
right: 0;
color: initial;
}

i.in-row-layer {
Expand Down
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 Expand Up @@ -541,6 +540,7 @@ private SideBarMenuItem createConfigurationMenu(boolean experimentalFeaturesEnab
item.addMainMenuItem(createMainMenuItem("PageAdmin.menu.top.configuration.internals", "fa fa-archive", PageInternals.class));
item.addMainMenuItem(createMainMenuItem("PageAdmin.menu.top.configuration.repoQuery", GuiStyleConstants.CLASS_ICON_SEARCH_FLIP + " flip-icon-margin", PageRepositoryQuery.class));
item.addMainMenuItem(createMainMenuItem("PageAdmin.menu.top.configuration.evaluateMapping", "fa fa-cog", PageEvaluateMapping.class));
item.addMainMenuItem(createMainMenuItem("PageAdmin.menu.top.configuration.authorizationPlayground", "fa fa-cog", PageAuthorizationPlayground.class));
item.addMainMenuItem(createMainMenuItem("PageAdmin.menu.top.configuration.about", "fa fa-info-circle", PageAbout.class));
return item;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.prism.xml.ns._public.query_3.SearchFilterType;

import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -167,30 +168,7 @@ public ObjectFilter createFilter(Class type, PageBase pageBase, VariablesMap var
} else

if (getPredefinedFilter() != null) {
if (!applyPredefinedFilter()) {
return null;
}
filter = getPredefinedFilter();

if (isEnabled()) {

if (filter != null) {
try {
//noinspection unchecked
if (parameterName != null && parameterValueType != null) {
variables.put(parameterName, new TypedValue(getValue().getValue(), parameterValueType));
}
ObjectFilter convertedFilter = pageBase.getPrismContext().getQueryConverter().parseFilter(filter, type);
convertedFilter = WebComponentUtil.evaluateExpressionsInFilter(convertedFilter, variables, new OperationResult("evaluated filter"), pageBase);
if (convertedFilter != null) {
return convertedFilter;
}
} catch (SchemaException e) {
LOGGER.error("Unable to parse filter {}, {} ", filter, e);
}
}
}
return null;
return evaluatePredefinedFilter(type, variables, pageBase);
}
if (getValue().getValue() == null) {
return null;
Expand Down Expand Up @@ -235,4 +213,44 @@ public ObjectFilter createFilter(Class type, PageBase pageBase, VariablesMap var
}
return null;
}

protected ObjectFilter evaluatePredefinedFilter(Class type, VariablesMap variables, PageBase pageBase) {
if (!applyPredefinedFilter()) {
return null;
}
SearchFilterType filter = getPredefinedFilter();

if (isEnabled()) {

if (filter != null) {
try {
//noinspection unchecked
if (parameterName != null && parameterValueType != null) {
if (variables == null) {
variables = new VariablesMap();
}

// FIXME TODO cleanup needed. While cleaning up, look also at createFilter method.
T realValue = getValue().getValue();
if (realValue instanceof ObjectReferenceType) {
if (((ObjectReferenceType) realValue).getOid() == null) {
realValue = null;
}
}

variables.put(parameterName, new TypedValue(realValue, parameterValueType));
}
ObjectFilter convertedFilter = pageBase.getPrismContext().getQueryConverter().parseFilter(filter, type);
convertedFilter = WebComponentUtil.evaluateExpressionsInFilter(convertedFilter, variables, new OperationResult("evaluated filter"), pageBase);
if (convertedFilter != null) {
return convertedFilter;
}
} catch (SchemaException e) {
LOGGER.error("Unable to parse filter {}, {} ", filter, e);
}
}
}
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ private List<QName> getSupportedTargetTypes() {

@Override
public ObjectFilter createFilter(Class type, PageBase pageBase, VariablesMap variables) {
if (getPredefinedFilter() != null) {
return evaluatePredefinedFilter(type, variables, pageBase);
}
PrismReferenceValue refValue = getValue().getValue().asReferenceValue();
if (refValue.isEmpty()) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

import java.util.List;
import java.util.stream.Collectors;
import jakarta.annotation.PostConstruct;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.xml.ns._public.common.common_3.CollectionRefSpecificationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import com.evolveum.midpoint.xml.ns._public.common.common_3.CompositeCorrelatorType;
import jakarta.annotation.PostConstruct;
import javax.xml.namespace.QName;

import org.springframework.stereotype.Component;

Expand All @@ -23,9 +22,10 @@
import com.evolveum.midpoint.prism.*;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.web.component.prism.ValueStatus;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractPolicyConstraintType;

/**
* Just like {@link PrismContainerWrapperFactoryImpl} but sets {@link PrismContainerValueWrapper#isHeterogenous()} flag to `true`.
*
* @author katka
*/
@Component
Expand Down Expand Up @@ -55,43 +55,45 @@ private boolean filterDefinitins(PrismContainerValue<C> value, ItemDefinition<?>
* match single value containers which contains a looot of other conainers, e.g. policy rule, policy action, notification configuration, etc
*/
@Override
public boolean match(ItemDefinition<?> def) {
if (def.getTypeClass() != null && def.getTypeClass().isAssignableFrom(CompositeCorrelatorType.class)) {
public boolean match(ItemDefinition<?> itemDef) {
if (itemDef.getTypeClass() != null && itemDef.getTypeClass().isAssignableFrom(CompositeCorrelatorType.class)) {
return false;
}

QName defName = def.getTypeName();
QName typeName = itemDef.getTypeName();

if (CollectionRefSpecificationType.COMPLEX_TYPE.equals(defName)
&& def.getItemName().equivalent(CollectionRefSpecificationType.F_BASE_COLLECTION_REF)) {
if (CollectionRefSpecificationType.COMPLEX_TYPE.equals(typeName)
&& itemDef.getItemName().equivalent(CollectionRefSpecificationType.F_BASE_COLLECTION_REF)) {
return true;
}

// TODO
// if (TaskPartsDefinitionType.COMPLEX_TYPE.equals(defName)) {
// return true;
// }
if (AuthorizationParentSelectorType.COMPLEX_TYPE.equals(typeName)
&& itemDef.getItemName().equivalent(AuthorizationObjectSelectorType.F_PARENT)) {
// The AuthorizationObjectSelectorType#parent points back to AuthorizationObjectSelectorType
// (via AuthorizationParentSelectorType), so normally an endless recursion would occur here.
// Therefore, we treat it as a heterogeneous container. At least for now.
//
// TODO review this; see MID-8910.
return true;
}

if (!(def instanceof PrismContainerDefinition)) {
if (!(itemDef instanceof PrismContainerDefinition<?> containerDef)) {
return false;
}

PrismContainerDefinition<?> containerDef = (PrismContainerDefinition<?>) def;

if (containerDef.isMultiValue() && isNotPolicyConstraint(containerDef)) {
return false;
}

List<? extends ItemDefinition> defs = containerDef.getDefinitions();
int containers = 0;
for (ItemDefinition<?> itemDef : defs) {
if (itemDef instanceof PrismContainerDefinition<?> && itemDef.isMultiValue()) {
containers++;
List<? extends ItemDefinition<?>> childDefs = containerDef.getDefinitions();
int multiValuedChildContainers = 0;
for (ItemDefinition<?> childItemDef : childDefs) {
if (childItemDef instanceof PrismContainerDefinition<?> && childItemDef.isMultiValue()) {
multiValuedChildContainers++;
}
}

return containers > 2;

return multiValuedChildContainers > 2;
}

private boolean isNotPolicyConstraint(PrismContainerDefinition<?> containerDef) {
Expand Down

0 comments on commit ee926a5

Please sign in to comment.