use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class TestCorrelationConfiramtionEvaluator method test002CorrelationMoreThanOne.
@Test
public void test002CorrelationMoreThanOne() throws Exception {
String TEST_NAME = "test002CorrelationMoreThanOne";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();
// importObjectFromFile(USER_JACK_FILENAME);
PrismObject<UserType> userType = repositoryService.getObject(UserType.class, USER_JACK_OID, null, result);
//assert jack
assertNotNull(userType);
ShadowType shadow = parseObjectType(ACCOUNT_SHADOW_JACK_DUMMY_FILE, ShadowType.class);
List<ConditionalSearchFilterType> filters = new ArrayList<>();
ConditionalSearchFilterType filter = PrismTestUtil.parseAtomicValue(new File(CORRELATION_FIRST_FILTER), ConditionalSearchFilterType.COMPLEX_TYPE);
filters.add(filter);
filter = PrismTestUtil.parseAtomicValue(new File(CORRELATION_SECOND_FILTER), ConditionalSearchFilterType.COMPLEX_TYPE);
filters.add(filter);
ResourceType resourceType = parseObjectType(RESOURCE_DUMMY_FILE, ResourceType.class);
List<PrismObject<UserType>> matchedUsers = evaluator.findFocusesByCorrelationRule(UserType.class, shadow, filters, resourceType, getSystemConfiguration(), task, result);
assertNotNull("Correlation evaluator returned null collection of matched users.", matchedUsers);
assertEquals("Found more than one user.", 1, matchedUsers.size());
PrismObject<UserType> jack = matchedUsers.get(0);
assertUser(jack, "c0c010c0-d34d-b33f-f00d-111111111111", "jack", "Jack Sparrow", "Jack", "Sparrow");
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class TestCorrelationConfiramtionEvaluator method test006CorrelationFindCaseInsensitive.
@Test
public void test006CorrelationFindCaseInsensitive() throws Exception {
String TEST_NAME = "test006CorrelationFindCaseInsensitive";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();
// importObjectFromFile(USER_JACK_FILENAME);
PrismObject<UserType> userType = repositoryService.getObject(UserType.class, USER_JACK_OID, null, result);
//assert jack
assertNotNull(userType);
ShadowType shadow = parseObjectType(ACCOUNT_SHADOW_JACK_DUMMY_FILE, ShadowType.class);
ConditionalSearchFilterType query = PrismTestUtil.parseAtomicValue(new File(CORRELATION_CASE_INSENSITIVE), ConditionalSearchFilterType.COMPLEX_TYPE);
List<ConditionalSearchFilterType> queries = new ArrayList<>();
queries.add(query);
//
ResourceType resourceType = parseObjectType(RESOURCE_DUMMY_FILE, ResourceType.class);
// resourceType.getSynchronization().getObjectSynchronization().get(0).getCorrelation().add(query);
userType.asObjectable().setName(new PolyStringType("JACK"));
Collection<? extends ItemDelta> modifications = PropertyDelta.createModificationReplacePropertyCollection(UserType.F_NAME, userType.getDefinition(), new PolyString("JACK", "jack"));
repositoryService.modifyObject(UserType.class, USER_JACK_OID, modifications, result);
List<PrismObject<UserType>> matchedUsers = evaluator.findFocusesByCorrelationRule(UserType.class, shadow, queries, resourceType, getSystemConfiguration(), task, result);
System.out.println("matched users " + matchedUsers);
assertNotNull("Correlation evaluator returned null collection of matched users.", matchedUsers);
assertEquals("Found more than one user.", 1, matchedUsers.size());
PrismObject<UserType> jack = matchedUsers.get(0);
assertUser(jack, "c0c010c0-d34d-b33f-f00d-111111111111", "JACK", "Jack Sparrow", "Jack", "Sparrow");
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class PageUserHistory method createMainPanel.
@Override
protected AbstractObjectMainPanel<UserType> createMainPanel(String id) {
return new FocusMainPanel<UserType>(id, getObjectModel(), getAssignmentsModel(), getProjectionModel(), this) {
@Override
protected List<ITab> createTabs(final PageAdminObjectDetails<UserType> parentPage) {
List<ITab> tabs = new ArrayList<>();
FocusTabVisibleBehavior authorization = new FocusTabVisibleBehavior(unwrapModel(), ComponentConstants.UI_FOCUS_TAB_BASIC_URL);
tabs.add(new PanelTab(parentPage.createStringResource("pageAdminFocus.basic"), authorization) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return createFocusDetailsTabPanel(panelId, parentPage);
}
});
//hidden, will be displayed in future version
// authorization = new FocusTabVisibleBehavior(unwrapModel(), ComponentConstants.UI_FOCUS_TAB_PROJECTIONS_URL);
// tabs.add(
// new CountablePanelTab(parentPage.createStringResource("pageAdminFocus.projections"), authorization) {
//
// private static final long serialVersionUID = 1L;
//
// @Override
// public WebMarkupContainer createPanel(String panelId) {
// return createFocusProjectionsTabPanel(panelId, parentPage);
// }
//
// @Override
// public String getCount() {
// return Integer.toString(getProjectionModel().getObject() == null ?
// 0 : getProjectionModel().getObject().size());
// }
// });
authorization = new FocusTabVisibleBehavior(unwrapModel(), ComponentConstants.UI_FOCUS_TAB_ASSIGNMENTS_URL);
tabs.add(new CountablePanelTab(parentPage.createStringResource("pageAdminFocus.assignments"), authorization) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return createFocusAssignmentsTabPanel(panelId, parentPage);
}
@Override
public String getCount() {
return Integer.toString(getAssignmentsModel().getObject() == null ? 0 : getAssignmentsModel().getObject().size());
}
});
authorization = new FocusTabVisibleBehavior(unwrapModel(), ComponentConstants.UI_FOCUS_TAB_DELEGATED_TO_ME_URL);
tabs.add(new CountablePanelTab(parentPage.createStringResource("FocusType.delegatedToMe"), authorization) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new AssignmentTablePanel<UserType>(panelId, parentPage.createStringResource("FocusType.delegatedToMe"), getDelegatedToMeModel()) {
private static final long serialVersionUID = 1L;
@Override
public void populateAssignmentDetailsPanel(ListItem<AssignmentEditorDto> item) {
DelegationEditorPanel editor = new DelegationEditorPanel(ID_ROW, item.getModel(), true, new ArrayList<AssignmentsPreviewDto>(), PageUserHistory.this);
item.add(editor);
}
@Override
public String getExcludeOid() {
return getObject().getOid();
}
@Override
protected List<InlineMenuItem> createAssignmentMenu() {
return new ArrayList<>();
}
};
}
@Override
public String getCount() {
return Integer.toString(getDelegatedToMeModel().getObject() == null ? 0 : getDelegatedToMeModel().getObject().size());
}
});
return tabs;
}
@Override
protected boolean getOptionsPanelVisibility() {
return false;
}
};
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class Expression method evaluate.
public PrismValueDeltaSetTriple<V> evaluate(ExpressionEvaluationContext context) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException {
ExpressionVariables processedVariables = null;
try {
processedVariables = processInnerVariables(context.getVariables(), context.getContextDescription(), context.getTask(), context.getResult());
ExpressionEvaluationContext contextWithProcessedVariables = context.shallowClone();
contextWithProcessedVariables.setVariables(processedVariables);
PrismValueDeltaSetTriple<V> outputTriple;
ObjectReferenceType runAsRef = null;
if (expressionType != null) {
runAsRef = expressionType.getRunAsRef();
}
if (runAsRef == null) {
outputTriple = evaluateExpressionEvaluators(contextWithProcessedVariables);
} else {
UserType userType = objectResolver.resolve(runAsRef, UserType.class, null, "runAs in " + context.getContextDescription(), context.getTask(), context.getResult());
LOGGER.trace("Running {} as {} ({})", context.getContextDescription(), userType, runAsRef);
try {
outputTriple = securityEnforcer.runAs(() -> {
try {
return evaluateExpressionEvaluators(contextWithProcessedVariables);
} catch (SchemaException | ExpressionEvaluationException | ObjectNotFoundException e) {
throw new TunnelException(e);
}
}, userType.asPrismObject());
} catch (TunnelException te) {
Throwable e = te.getCause();
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
if (e instanceof Error) {
throw (Error) e;
}
if (e instanceof SchemaException) {
throw (SchemaException) e;
}
if (e instanceof ExpressionEvaluationException) {
throw (ExpressionEvaluationException) e;
}
if (e instanceof ObjectNotFoundException) {
throw (ObjectNotFoundException) e;
}
throw te;
}
}
traceSuccess(context, processedVariables, outputTriple);
return outputTriple;
} catch (SchemaException | ExpressionEvaluationException | ObjectNotFoundException | RuntimeException | Error e) {
traceFailure(context, processedVariables, e);
throw e;
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.
the class AbstractAdLdapMultidomainTest method test260EnableGyubrush.
@Test
public void test260EnableGyubrush() throws Exception {
final String TEST_NAME = "test260EnableGyubrush";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
modifyUserReplace(USER_GUYBRUSH_OID, new ItemPath(UserType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS), task, result, ActivationStatusType.ENABLED);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> user = getUser(USER_GUYBRUSH_OID);
assertAdministrativeStatus(user, ActivationStatusType.ENABLED);
Entry entry = assertLdapAccount(USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME);
assertAttribute(entry, ATTRIBUTE_USER_ACCOUNT_CONTROL_NAME, "512");
String shadowOid = getSingleLinkOid(user);
PrismObject<ShadowType> shadow = getObject(ShadowType.class, shadowOid);
assertAccountEnabled(shadow);
assertLdapPassword(USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, "wanna.be.a.123");
// assertLdapConnectorInstances(2);
}
Aggregations