Search in sources :

Example 1 with CompiledGuiProfile

use of com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile in project midpoint by Evolveum.

the class LeftMenuPanel method createAdditionalMenu.

private SideBarMenuItem createAdditionalMenu(boolean experimentalFeaturesEnabled) {
    SideBarMenuItem menu = new SideBarMenuItem("PageAdmin.menu.additional", experimentalFeaturesEnabled);
    CompiledGuiProfile userProfile = getPageBase().getCompiledGuiProfile();
    List<RichHyperlinkType> menuList = userProfile.getAdditionalMenuLink();
    if (CollectionUtils.isEmpty(menuList)) {
        return menu;
    }
    Map<String, Class> urlClassMap = PageMounter.getUrlClassMap();
    if (MapUtils.isEmpty(urlClassMap)) {
        return menu;
    }
    for (RichHyperlinkType link : menuList) {
        if (StringUtils.isBlank(link.getTargetUrl())) {
            continue;
        }
        AdditionalMenuItem item = new AdditionalMenuItem(link, urlClassMap.get(link.getTargetUrl()));
        menu.addMainMenuItem(item);
    }
    return menu;
}
Also used : CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile)

Example 2 with CompiledGuiProfile

use of com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile in project midpoint by Evolveum.

the class PageBaseSystemConfiguration method createObjectDetailsModels.

@Override
protected AssignmentHolderDetailsModel<SystemConfigurationType> createObjectDetailsModels(PrismObject<SystemConfigurationType> object) {
    return new AssignmentHolderDetailsModel<>(createPrismObjectModel(object), this) {

        @Override
        protected GuiObjectDetailsPageType loadDetailsPageConfiguration(PrismObject<SystemConfigurationType> assignmentHolder) {
            CompiledGuiProfile profile = getModelServiceLocator().getCompiledGuiProfile();
            try {
                GuiObjectDetailsPageType defaultPageConfig = null;
                for (Class<? extends Containerable> clazz : getAllDetailsTypes()) {
                    QName type = GuiImplUtil.getContainerableTypeName(clazz);
                    if (defaultPageConfig == null) {
                        defaultPageConfig = profile.findObjectDetailsConfiguration(type);
                    } else {
                        GuiObjectDetailsPageType anotherConfig = profile.findObjectDetailsConfiguration(type);
                        defaultPageConfig = getModelServiceLocator().getAdminGuiConfigurationMergeManager().mergeObjectDetailsPageConfiguration(defaultPageConfig, anotherConfig);
                    }
                }
                return applyArchetypePolicy(defaultPageConfig);
            } catch (Exception ex) {
                LOGGER.error("Couldn't create default gui object details page and apply archetype policy", ex);
            }
            return null;
        }
    };
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) GuiObjectDetailsPageType(com.evolveum.midpoint.xml.ns._public.common.common_3.GuiObjectDetailsPageType) QName(javax.xml.namespace.QName) AssignmentHolderDetailsModel(com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel) CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile)

Example 3 with CompiledGuiProfile

use of com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile in project midpoint by Evolveum.

the class PageSelfDashboard method getComponentVisibility.

private UserInterfaceElementVisibilityType getComponentVisibility(PredefinedDashboardWidgetId componentId) {
    CompiledGuiProfile compiledGuiProfile = getCompiledGuiProfile();
    if (compiledGuiProfile.getUserDashboard() == null) {
        return UserInterfaceElementVisibilityType.AUTOMATIC;
    }
    List<DashboardWidgetType> widgetsList = compiledGuiProfile.getUserDashboard().getWidget();
    if (widgetsList == null || widgetsList.size() == 0) {
        return UserInterfaceElementVisibilityType.VACANT;
    }
    DashboardWidgetType widget = compiledGuiProfile.findUserDashboardWidget(componentId.getUri());
    if (widget == null || widget.getVisibility() == null) {
        return UserInterfaceElementVisibilityType.HIDDEN;
    } else {
        return widget.getVisibility();
    }
}
Also used : CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile)

Example 4 with CompiledGuiProfile

use of com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile in project midpoint by Evolveum.

the class AssignmentPolicyAspectPart method extractAssignmentBasedInstructions.

void extractAssignmentBasedInstructions(ObjectTreeDeltas<?> objectTreeDeltas, PrismObject<? extends FocusType> requester, List<PcpStartInstruction> instructions, ModelInvocationContext<?> ctx, OperationResult parentResult) throws SchemaException, ObjectNotFoundException {
    OperationResult result = parentResult.subresult(OP_EXTRACT_ASSIGNMENT_BASED_INSTRUCTIONS).setMinor().build();
    ApprovalProcessStartInstructionCreationTraceType trace;
    if (result.isTracingNormal(ApprovalProcessStartInstructionCreationTraceType.class)) {
        trace = new ApprovalProcessStartInstructionCreationTraceType(prismContext);
        result.addTrace(trace);
    } else {
        trace = null;
    }
    try {
        DeltaSetTriple<? extends EvaluatedAssignment<?>> evaluatedAssignmentTriple = ((LensContext<?>) ctx.modelContext).getEvaluatedAssignmentTriple();
        LOGGER.trace("Processing evaluatedAssignmentTriple:\n{}", DebugUtil.debugDumpLazily(evaluatedAssignmentTriple));
        if (evaluatedAssignmentTriple == null) {
            return;
        }
        List<PcpStartInstruction> newInstructions = new ArrayList<>();
        for (EvaluatedAssignment<?> assignmentAdded : evaluatedAssignmentTriple.union()) {
            addIgnoreNull(newInstructions, createInstructionFromAssignment(assignmentAdded, objectTreeDeltas, requester, ctx, result));
        }
        int newInstructionsCount = newInstructions.size();
        if (trace != null) {
            for (PcpStartInstruction newInstruction : newInstructions) {
                trace.getCaseRef().add(ObjectTypeUtil.createObjectRefWithFullObject(newInstruction.getCase(), prismContext));
            }
        }
        instructions.addAll(newInstructions);
        CompiledGuiProfile adminGuiConfiguration;
        try {
            adminGuiConfiguration = modelInteractionService.getCompiledGuiProfile(ctx.task, result);
        } catch (CommunicationException | ConfigurationException | SecurityViolationException | ExpressionEvaluationException e) {
            throw new SystemException(e.getMessage(), e);
        }
        Integer limit = adminGuiConfiguration.getRoleManagement() != null ? adminGuiConfiguration.getRoleManagement().getAssignmentApprovalRequestLimit() : null;
        LOGGER.trace("Assignment-related approval instructions: {}; limit is {}", newInstructionsCount, limit);
        if (limit != null && newInstructionsCount > limit) {
            // TODO think about better error reporting
            throw new IllegalStateException("Assignment approval request limit (" + limit + ") exceeded: you are trying to submit " + newInstructionsCount + " requests");
        }
        if (limit != null) {
            result.addContext("assignmentApprovalRequestLimit", limit);
        }
        result.addReturn("instructionsCreated", newInstructions.size());
    } catch (Throwable t) {
        result.recordFatalError(t);
        throw t;
    } finally {
        result.computeStatusIfUnknown();
    }
}
Also used : ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) LensContext(com.evolveum.midpoint.model.impl.lens.LensContext) SystemException(com.evolveum.midpoint.util.exception.SystemException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) PcpStartInstruction(com.evolveum.midpoint.wf.impl.processors.primary.PcpStartInstruction) CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile)

Example 5 with CompiledGuiProfile

use of com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile in project midpoint by Evolveum.

the class TestArchetypes method test205GetGuybryshCompiledGuiProfileActiveEmployeesView.

@Test
public void test205GetGuybryshCompiledGuiProfileActiveEmployeesView() throws Exception {
    // GIVEN
    login(USER_GUYBRUSH_USERNAME);
    Task task = getTestTask();
    OperationResult result = task.getResult();
    // WHEN
    CompiledGuiProfile compiledGuiProfile = modelInteractionService.getCompiledGuiProfile(task, result);
    // THEN
    assertSuccess(result);
    loginAdministrator();
    ObjectFilter activeEmployeesViewFilter = assertCompiledGuiProfile(compiledGuiProfile).objectCollectionViews().assertViews(3).by().identifier(VIEW_ACTIVE_EMPLOYEES_IDENTIFIER).find().assertName(VIEW_ACTIVE_EMPLOYEES_IDENTIFIER).assertFilter().getFilter();
    ObjectQuery viewQuery = prismContext.queryFactory().createQuery(activeEmployeesViewFilter, null);
    SearchResultList<PrismObject<UserType>> searchResults = modelService.searchObjects(UserType.class, viewQuery, null, task, result);
    display("Search results", searchResults);
    assertEquals("Wrong number of search results", 1, searchResults.size());
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) CompiledGuiProfile(com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile) Test(org.testng.annotations.Test)

Aggregations

CompiledGuiProfile (com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile)19 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)9 Task (com.evolveum.midpoint.task.api.Task)6 PrismObject (com.evolveum.midpoint.prism.PrismObject)4 Test (org.testng.annotations.Test)4 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)3 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)3 CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)2 GuiProfiledPrincipal (com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipal)2 ArrayList (java.util.ArrayList)2 RestartResponseException (org.apache.wicket.RestartResponseException)2 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)1 AssignmentHolderDetailsModel (com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel)1 ModelInteractionService (com.evolveum.midpoint.model.api.ModelInteractionService)1 LensContext (com.evolveum.midpoint.model.impl.lens.LensContext)1 Referencable (com.evolveum.midpoint.prism.Referencable)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 ExpressionEvaluationContext (com.evolveum.midpoint.repo.common.expression.ExpressionEvaluationContext)1 ExpressionFactory (com.evolveum.midpoint.repo.common.expression.ExpressionFactory)1 VariablesMap (com.evolveum.midpoint.schema.expression.VariablesMap)1