Skip to content

Commit

Permalink
Merge branch 'master' into feature/password-retention
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Mar 23, 2016
2 parents 2847745 + f3a8583 commit 51867e2
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 43 deletions.
Expand Up @@ -17,10 +17,8 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<tr>
<td style="vertical-align:middle" wicket:id="nameContainer"><span wicket:id="name"/></td>
<td wicket:id="oldValueContainer"><div wicket:id="oldValue"/></td>
<td wicket:id="newValueContainer"><div wicket:id="newValue"/></td>
</tr>
<td style="vertical-align:middle" wicket:id="nameContainer"><span wicket:id="name"/></td>
<td wicket:id="oldValueContainer"><div wicket:id="oldValue"/></td>
<td wicket:id="newValueContainer"><div wicket:id="newValue"/></td>
</wicket:panel>
</html>
Expand Up @@ -44,14 +44,14 @@ public class SceneItemLinePanel extends BasePanel<SceneItemLineDto> {

public SceneItemLinePanel(String id, IModel<SceneItemLineDto> model) {
super(id, model);
setOutputMarkupId(true);

initLayout();
}

private void initLayout() {
WebMarkupContainer nameCell = new WebMarkupContainer(ID_NAME_CONTAINER);
nameCell.add(new AttributeModifier("rowspan", new PropertyModel<Integer>(getModel(), SceneItemLineDto.F_NUMBER_OF_LINES)));
nameCell.add(new AttributeModifier("rowspan",
new PropertyModel<Integer>(getModel(), SceneItemLineDto.F_NUMBER_OF_LINES)));
Label label = new Label("name", new PropertyModel<String>(getModel(), SceneItemLineDto.F_NAME));
nameCell.add(label);
nameCell.add(new VisibleEnableBehaviour() {
Expand All @@ -69,11 +69,17 @@ public boolean isVisible() {
return getModelObject().isDelta();
}
});
oldValueCell.add(new SceneItemValuePanel(ID_OLD_VALUE, new PropertyModel<SceneItemValue>(getModel(), SceneItemLineDto.F_OLD_VALUE)));
SceneItemValuePanel sivp = new SceneItemValuePanel(ID_OLD_VALUE,
new PropertyModel<SceneItemValue>(getModel(), SceneItemLineDto.F_OLD_VALUE));
sivp.setRenderBodyOnly(true);
oldValueCell.add(sivp);
add(oldValueCell);

WebMarkupContainer newValueCell = new WebMarkupContainer(ID_NEW_VALUE_CONTAINER);
newValueCell.add(new SceneItemValuePanel(ID_NEW_VALUE, new PropertyModel<SceneItemValue>(getModel(), SceneItemLineDto.F_NEW_VALUE)));
sivp = new SceneItemValuePanel(ID_NEW_VALUE,
new PropertyModel<SceneItemValue>(getModel(), SceneItemLineDto.F_NEW_VALUE));
sivp.setRenderBodyOnly(true);
newValueCell.add(sivp);
newValueCell.add(new AttributeModifier("colspan", new AbstractReadOnlyModel<Integer>() {
@Override
public Integer getObject() {
Expand Down
Expand Up @@ -17,10 +17,10 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div wicket:id="itemLines">
<wicket:container wicket:id="itemLines">
<wicket:enclosure child="itemLine">
<div wicket:id="itemLine"/>
<tr wicket:id="itemLine"/>
</wicket:enclosure>
</div>
</wicket:container>
</wicket:panel>
</html>
Expand Up @@ -40,17 +40,17 @@ public class SceneItemPanel extends Panel {

public SceneItemPanel(String id, IModel<SceneItemDto> model) {
super(id);
setOutputMarkupId(true);

initLayout(model);
}

private void initLayout(final IModel<SceneItemDto> model) {
ListView<SceneItemLineDto> items = new ListView<SceneItemLineDto>(ID_ITEM_LINES, new PropertyModel<List<SceneItemLineDto>>(model, SceneItemDto.F_LINES)) {
ListView<SceneItemLineDto> items = new ListView<SceneItemLineDto>(ID_ITEM_LINES,
new PropertyModel<List<SceneItemLineDto>>(model, SceneItemDto.F_LINES)) {

@Override
protected void populateItem(ListItem<SceneItemLineDto> item) {
SceneItemLinePanel panel = new SceneItemLinePanel(ID_ITEM_LINE, item.getModel());
panel.setOutputMarkupPlaceholderTag(true);
item.add(panel);
}
};
Expand Down
Expand Up @@ -20,11 +20,11 @@
<div class="box" wicket:id="box" style="margin-bottom: 0px;">
<div class="box-header with-border" wicket:id="headerPanel">
<h3 class="box-title" style="margin-right: 35px;">
<span wicket:id="wrapperDisplayName"/>
<span wicket:id="changeType"/>
<span wicket:id="objectType"/>
<small>
<span wicket:id="nameLabel"/><span wicket:id="nameLink"/> <span wicket:id="description"/>
<span wicket:id="wrapperDisplayName"/>
</small>
</h3>
<div class="box-tools pull-right" wicket:id="optionButtons" />
Expand All @@ -38,13 +38,13 @@ <h3 class="box-title" style="margin-right: 35px;">
<th wicket:id="newValueLabel"><wicket:message key="ScenePanel.newValue"/></th>
<th wicket:id="valueLabel"><wicket:message key="ScenePanel.value"/></th>
</tr>
<div wicket:id="items">
<div wicket:id="item"/>
</div>
<wicket:container wicket:id="items">
<span wicket:id="item"/>
</wicket:container>
</table>
<div wicket:id="partialScenes" style="padding: 10px;">
<div wicket:id="partialScene"/>
</div>
<wicket:container wicket:id="partialScenes">
<div wicket:id="partialScene" style="padding: 10px;"/>
</wicket:container>
</div>
</div>
</wicket:panel>
Expand Down
Expand Up @@ -133,6 +133,7 @@ public void minimizeOnClick(AjaxRequestTarget target) {
PropertyModel<String> nameModel = new PropertyModel<>(model, SceneDto.F_NAME);
Label headerNameLabel = new Label(ID_HEADER_NAME_LABEL, nameModel);
LinkPanel<String> headerNameLink = new LinkPanel<String>(ID_HEADER_NAME_LINK, nameModel) {

@Override
public void onClick(AjaxRequestTarget target) {
PrismContainerValue<?> value = getModelObject().getScene().getSourceValue();
Expand Down Expand Up @@ -247,11 +248,13 @@ public boolean isVisible() {
}
});
itemsTable.add(valueLabel);
ListView<SceneItemDto> items = new ListView<SceneItemDto>(ID_ITEMS, new PropertyModel<List<SceneItemDto>>(model, SceneDto.F_ITEMS)) {
ListView<SceneItemDto> items = new ListView<SceneItemDto>(ID_ITEMS,
new PropertyModel<List<SceneItemDto>>(model, SceneDto.F_ITEMS)) {

@Override
protected void populateItem(ListItem<SceneItemDto> item) {
SceneItemPanel panel = new SceneItemPanel(ID_ITEM, item.getModel());
panel.setOutputMarkupPlaceholderTag(true);
panel.setRenderBodyOnly(true);
item.add(panel);
}
};
Expand Down Expand Up @@ -290,6 +293,7 @@ public void headerOnClickPerformed(AjaxRequestTarget target, IModel<SceneDto> mo
}

private class ChangeTypeModel extends AbstractReadOnlyModel<String> {

@Override
public String getObject() {
ChangeType changeType = getModel().getObject().getScene().getChangeType();
Expand All @@ -301,6 +305,7 @@ public String getObject() {
}

private class ObjectTypeModel extends AbstractReadOnlyModel<String> {

@Override
public String getObject() {
Scene scene = getModel().getObject().getScene();
Expand Down
Expand Up @@ -43,6 +43,12 @@ public class SearchFactory {
new ItemPath(UserType.F_FAMILY_NAME),
new ItemPath(UserType.F_FULL_NAME),
new ItemPath(UserType.F_ADDITIONAL_NAME),
new ItemPath(UserType.F_COST_CENTER),
new ItemPath(UserType.F_EMAIL_ADDRESS),
new ItemPath(UserType.F_TELEPHONE_NUMBER),
new ItemPath(UserType.F_EMPLOYEE_NUMBER),
new ItemPath(UserType.F_EMPLOYEE_TYPE),
new ItemPath(UserType.F_ORGANIZATIONAL_UNIT),
new ItemPath(UserType.F_COST_CENTER)));
SEARCHABLE_OBJECTS.put(RoleType.class, Arrays.asList(
new ItemPath(RoleType.F_NAME),
Expand Down
Expand Up @@ -113,7 +113,7 @@ public PrismValueDeltaSetTriple<PrismContainerValue<ShadowAssociationType>> eval
// Always process the first role (myself) regardless of recursion setting
gatherAssociationsFromAbstractRole(thisRole, output, resourceOid, kind, intent, assocName, options, desc, params);

if (thisRole instanceof OrgType) {
if (thisRole instanceof OrgType && matchesForRecursion((OrgType)thisRole)) {
gatherAssociationsFromAbstractRoleRecurse((OrgType)thisRole, output, resourceOid, kind, intent, assocName, options, desc, params);
}

Expand Down Expand Up @@ -150,12 +150,13 @@ private void gatherAssociationsFromAbstractRoleRecurse(OrgType thisOrg,
String intent, QName assocName, Collection<SelectorOptions<GetOperationOptions>> options,
String desc, ExpressionEvaluationContext params) throws SchemaException, ObjectNotFoundException {

if (!matchesForRecursion(thisOrg)) {
return;
}
gatherAssociationsFromAbstractRole(thisOrg, output, resourceOid, kind, intent, assocName, options, desc, params);

for (ObjectReferenceType parentOrgRef: thisOrg.getParentOrgRef()) {
OrgType parent = objectResolver.resolve(parentOrgRef, OrgType.class, options, desc, params.getTask(), params.getResult());
gatherAssociationsFromAbstractRole(parent, output, resourceOid, kind, intent, assocName, options, desc, params);
if (matchesForRecursion(parent)) {
gatherAssociationsFromAbstractRoleRecurse(parent, output, resourceOid, kind, intent, assocName, options, desc, params);
}
}
}

Expand Down
Expand Up @@ -204,7 +204,7 @@ private <F extends FocusType> void processInboundExpressionsForProjection(LensCo
PropertyDelta<?> accountAttributeDelta = null;
if (aPrioriDelta != null) {
accountAttributeDelta = aPrioriDelta.findPropertyDelta(new ItemPath(SchemaConstants.C_ATTRIBUTES), accountAttributeName);
if (accountAttributeDelta == null && !projContext.isFullShadow()) {
if (accountAttributeDelta == null && !projContext.isFullShadow() && !LensUtil.hasDependentContext(context, projContext)) {
LOGGER.trace("Skipping inbound for {} in {}: Not a full shadow and account a priori delta exists, but doesn't have change for processed property.",
accountAttributeName, projContext.getResourceShadowDiscriminator());
continue;
Expand Down
Expand Up @@ -529,8 +529,8 @@ public void test230ScroogeAddAccountDummyConflictingNoShadow() throws Exception
dummyResourcePink.addAccount(account);

PrismObject<UserType> userScrooge = createUser("scrooge", "Scrooge McDuck", true);
ShadowType newPinkyShadow = createShadow(resourceDummyPinkType.asPrismObject(), null, null).asObjectable();
userScrooge.asObjectable().getLink().add(newPinkyShadow);
PrismObject<ShadowType> newPinkyShadow = createShadow(resourceDummyPinkType.asPrismObject(), null, null);
userScrooge.asObjectable().getLink().add(newPinkyShadow.asObjectable());

Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<ObjectDelta<? extends ObjectType>>();
deltas.add(ObjectDelta.createAddDelta(userScrooge));
Expand Down Expand Up @@ -577,8 +577,8 @@ public void test235HackerAddAccountDummyEternalConflict() throws Exception {
dummyAuditService.clear();

PrismObject<UserType> userJoeHacker = createUser("hacker", "Joe Hacker", true);
ShadowType newPinkyShadow = createShadow(resourceDummyPinkType.asPrismObject(), null, null).asObjectable();
userJoeHacker.asObjectable().getLink().add(newPinkyShadow);
PrismObject<ShadowType> newPinkyShadow = createShadow(resourceDummyPinkType.asPrismObject(), null, null);
userJoeHacker.asObjectable().getLink().add(newPinkyShadow.asObjectable());

Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<ObjectDelta<? extends ObjectType>>();
deltas.add(ObjectDelta.createAddDelta(userJoeHacker));
Expand Down
Expand Up @@ -638,13 +638,17 @@ private <T extends ObjectType> PrismObject<T> completeObject(Class<T> type, Pris
PrismObject<ResourceType> completeResource = resourceManager.getResource((PrismObject<ResourceType>) inObject,
SelectorOptions.findRootOptions(options), result);
return (PrismObject<T>) completeResource;
} else {
} else if (ShadowType.class.equals(type)) {
//TODO: applyDefinition???
applyDefinition(inObject, result);
setProtectedShadow((PrismObject<ShadowType>) inObject, result);
return inObject;

} else {
//TODO: connectors etc..

}
return inObject;

}

Expand Down
Expand Up @@ -100,6 +100,7 @@ public class TestFlatLdap extends AbstractStoryTest {

private static final String ORG_ROYULA_CARPATHIA_NAME = "Royula Carpathia";
private static final String ORG_CORTUV_HRAD_NAME = "Čortův hrád";
private static final String ORG_VYSNE_VLKODLAKY_NAME = "Vyšné Vlkodlaky";

private static final String ORG_TYPE_FUNCTIONAL = "functional";

Expand All @@ -113,6 +114,9 @@ public class TestFlatLdap extends AbstractStoryTest {
private static final String USER_GORC_GIVEN_NAME = "Robert";
private static final String USER_GORC_FAMILY_NAME = "Gorc z Gorců";

private static final String USER_DEZI_USERNAME = "dezi";
private static final String USER_DEZI_GIVEN_NAME = "Vilja";
private static final String USER_DEZI_FAMILY_NAME = "Dézi";

protected ResourceType resourceOpenDjType;
protected PrismObject<ResourceType> resourceOpenDj;
Expand All @@ -121,6 +125,8 @@ public class TestFlatLdap extends AbstractStoryTest {

private String orgCortuvHradOid;

private String orgVysneVlkodlakyOid;

@Override
protected void startResources() throws Exception {
openDJController.startCleanServerRI();
Expand Down Expand Up @@ -278,6 +284,62 @@ public void test210AddUserGorc() throws Exception {
dumpOrgTree();
}

@Test
public void test220AddOrgVysneVlkodlaky() throws Exception {
final String TEST_NAME = "test220AddOrgVysneVlkodlaky";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestFlatLdap.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();

PrismObject<OrgType> orgBefore = createOrg(ORG_VYSNE_VLKODLAKY_NAME, orgCortuvHradOid);

// WHEN
TestUtil.displayWhen(TEST_NAME);
display("Adding org", orgBefore);
addObject(orgBefore, task, result);

// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);

PrismObject<OrgType> orgAfter = getAndAssertFunctionalOrg(ORG_VYSNE_VLKODLAKY_NAME);
orgVysneVlkodlakyOid = orgAfter.getOid();

dumpOrgTree();

assertHasOrg(orgAfter, orgCortuvHradOid);
assertAssignedOrg(orgAfter, orgCortuvHradOid);
assertSubOrgs(orgAfter, 0);
assertSubOrgs(orgRolyulaCarpathiaOid, 1);
assertSubOrgs(ORG_TOP_OID, 1);
}

@Test
public void test230AddUserViljaDezi() throws Exception {
final String TEST_NAME = "test230AddUserViljaDezi";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestFlatLdap.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();

PrismObject<UserType> userBefore = createUser(USER_DEZI_USERNAME,
USER_DEZI_GIVEN_NAME, USER_DEZI_FAMILY_NAME, orgVysneVlkodlakyOid);

// WHEN
TestUtil.displayWhen(TEST_NAME);
display("Adding user", userBefore);
addObject(userBefore, task, result);

// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);

PrismObject<UserType> userAfter = getAndAssertUser(USER_DEZI_USERNAME, ORG_VYSNE_VLKODLAKY_NAME, ORG_CORTUV_HRAD_NAME, ORG_ROYULA_CARPATHIA_NAME);

dumpOrgTree();
}



private PrismObject<UserType> createUser(String username, String givenName,
Expand Down
16 changes: 8 additions & 8 deletions testing/story/src/test/resources/science/resource-dummy-unix.xml
Expand Up @@ -121,13 +121,13 @@
<modify>false</modify>
</access>
</limitations>
<outbound>
<strength>weak</strength>
<source>
<c:path xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:ext="http://midpoint.evolveum.com/xml/ns/science/user/ext">extension/ext:aixUserId</c:path>
</source>
</outbound>
<!-- <outbound> -->
<!-- <strength>weak</strength> -->
<!-- <source> -->
<!-- <c:path xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" -->
<!-- xmlns:ext="http://midpoint.evolveum.com/xml/ns/science/user/ext">extension/ext:aixUserId</c:path> -->
<!-- </source> -->
<!-- </outbound> -->
<inbound>
<strength>strong</strength>
<target>
Expand All @@ -148,7 +148,7 @@
</attribute>
<dependency>
<resourceRef oid="10000000-0000-0000-0000-0000000001ad"/>
<strictness>strict</strictness>
<strictness>relaxed</strictness>
</dependency>

<activation>
Expand Down

0 comments on commit 51867e2

Please sign in to comment.