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;
}
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;
}
};
}
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();
}
}
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();
}
}
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());
}
Aggregations