Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Apr 26, 2016
2 parents ee08b5a + 4ccd18a commit 7adc33a
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 11 deletions.
Expand Up @@ -28,6 +28,10 @@
import com.evolveum.midpoint.web.component.search.Search;
import com.evolveum.midpoint.web.component.search.SearchFactory;
import com.evolveum.midpoint.web.component.search.SearchPanel;
import com.evolveum.midpoint.web.page.admin.home.PageDashboard;
import com.evolveum.midpoint.web.page.admin.server.PageTaskEdit;
import com.evolveum.midpoint.web.page.admin.server.PageTasks;
import com.evolveum.midpoint.web.util.OnePageParameterEncoder;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
Expand Down Expand Up @@ -607,25 +611,33 @@ private void deleteAllIdentitiesConfirmed(AjaxRequestTarget target, DeleteAllDto
options.add(SelectorOptions.create(ItemPath.EMPTY_PATH, opt));

OperationResult result = new OperationResult(OPERATION_LAXATIVE_DELETE);
String taskOid = null;
try {
if (dto.getDeleteUsers()) {
ObjectQuery query = createDeleteAllUsersQuery();
deleteObjectsAsync(UserType.COMPLEX_TYPE, query, true, "Delete all users", result);
taskOid = deleteObjectsAsync(UserType.COMPLEX_TYPE, query, true, "Delete all users", result);
}
if (dto.getDeleteOrgs()) {
deleteObjectsAsync(OrgType.COMPLEX_TYPE, null, true, "Delete all orgs", result);
taskOid = deleteObjectsAsync(OrgType.COMPLEX_TYPE, null, true, "Delete all orgs", result);
}
if (dto.getDeleteAccountShadow()) {
deleteAllShadowsConfirmed(result, true);
taskOid = deleteAllShadowsConfirmed(result, true);
}
if (dto.getDeleteNonAccountShadow()) {
deleteAllShadowsConfirmed(result, false);
taskOid = deleteAllShadowsConfirmed(result, false);
}
} catch (Exception ex) {
result.computeStatus(getString("pageDebugList.message.laxativeProblem"));
LoggingUtils.logException(LOGGER, getString("pageDebugList.message.laxativeProblem"), ex);
}

if (taskOid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, taskOid);
setResponsePage(PageTaskEdit.class, parameters);
} else {
setResponsePage(PageTasks.class);
}
target.add(getFeedbackPanel());

result.recomputeStatus();
Expand All @@ -639,7 +651,7 @@ private ObjectQuery createDeleteAllUsersQuery() {
return ObjectQuery.createObjectQuery(not);
}

private void deleteAllShadowsConfirmed(OperationResult result, boolean deleteAccountShadows)
private String deleteAllShadowsConfirmed(OperationResult result, boolean deleteAccountShadows)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException {

ObjectFilter kind = EqualFilter.createEqual(ShadowType.F_KIND, ShadowType.class, getPrismContext(),
Expand All @@ -655,7 +667,8 @@ private void deleteAllShadowsConfirmed(OperationResult result, boolean deleteAcc
query = ObjectQuery.createObjectQuery(NotFilter.createNot(kind));
}

deleteObjectsAsync(ShadowType.COMPLEX_TYPE, query, true, taskName, result);
return deleteObjectsAsync(ShadowType.COMPLEX_TYPE, query, true, taskName, result);

}

private void exportSelected(AjaxRequestTarget target, DebugObjectItem item) {
Expand Down Expand Up @@ -737,6 +750,7 @@ private void deleteAllTypeConfirmed(AjaxRequestTarget target) {
LOGGER.debug("Deleting all of type {}", dto.getType());

OperationResult result = new OperationResult(OPERATION_DELETE_OBJECTS);
String taskOid = null;
try {
ObjectQuery query = null;
if (ObjectTypes.USER.equals(dto.getType())) {
Expand All @@ -745,7 +759,7 @@ private void deleteAllTypeConfirmed(AjaxRequestTarget target) {

QName type = dto.getType().getTypeQName();

deleteObjectsAsync(type, query, true, "Delete all of type " + type.getLocalPart(), result);
taskOid = deleteObjectsAsync(type, query, true, "Delete all of type " + type.getLocalPart(), result);

info(getString("pageDebugList.messsage.deleteAllOfType", dto.getType()));
} catch (Exception ex) {
Expand All @@ -756,6 +770,13 @@ private void deleteAllTypeConfirmed(AjaxRequestTarget target) {
}

showResult(result);
if (taskOid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, taskOid);
setResponsePage(PageTaskEdit.class, parameters);
} else {
setResponsePage(PageTasks.class);
}
target.add(getFeedbackPanel());
}

Expand Down Expand Up @@ -849,14 +870,15 @@ private void deleteAllShadowsOnResourceConfirmed(AjaxRequestTarget target) {
LOGGER.debug("Deleting shadows on resource {}", resourceOid);

OperationResult result = new OperationResult(OPERATION_DELETE_SHADOWS);
String taskOid = null;
try {
RefFilter ref = RefFilter.createReferenceEqual(ShadowType.F_RESOURCE_REF, ShadowType.class,
getPrismContext(), dto.getResource().getOid());
ObjectQuery objectQuery = ObjectQuery.createObjectQuery(ref);

QName type = ShadowType.COMPLEX_TYPE;

deleteObjectsAsync(type, objectQuery, true, "Delete shadows on " + dto.getResource().getName(),
taskOid = deleteObjectsAsync(type, objectQuery, true, "Delete shadows on " + dto.getResource().getName(),
result);

info(getString("pageDebugList.messsage.deleteAllShadowsStarted", dto.getResource().getName()));
Expand All @@ -868,10 +890,17 @@ private void deleteAllShadowsOnResourceConfirmed(AjaxRequestTarget target) {
}

showResult(result);
if (taskOid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, taskOid);
setResponsePage(PageTaskEdit.class, parameters);
} else {
setResponsePage(PageTasks.class);
}
target.add(getFeedbackPanel());
}

private void deleteObjectsAsync(QName type, ObjectQuery objectQuery, boolean raw, String taskName,
private String deleteObjectsAsync(QName type, ObjectQuery objectQuery, boolean raw, String taskName,
OperationResult result)
throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException {

Expand Down Expand Up @@ -908,6 +937,7 @@ private void deleteObjectsAsync(QName type, ObjectQuery objectQuery, boolean raw
TaskManager taskManager = getTaskManager();
taskManager.switchToBackground(task, result);
result.setBackgroundTaskOid(task.getOid());
return task.getOid();
}

private static class SearchFragment extends Fragment {
Expand Down
Expand Up @@ -3067,7 +3067,7 @@ ChangePasswordPanel.enabled=Enabled
ChangePasswordPanel.legendMessage.selected= - Password will be changed
ChangePasswordPanel.legendMessage.propagated= - Automatic password propagation (based on policies defined in resources definitions)
ChangePasswordPanel.legendMessage.deselected= - Password will not be changed
ChangePasswordPanel.helpInfo=<p>This portion of the credentials dialog controls how the password change will be propagated to each individual system. The first line defines whether the password will be changes in the midPoint itself. Following lines represent each system for which the password can be changed. The password propagation is controlled by the icons:</p><ul><li><span class="fa fa-check-square-o"/> Password will be changed. Password for this system will be changed to the value specified in the password dialog above.</li><li><span class="fa fa-sign-out"/> Automatic password propagation. The password might be changed. Whether the password is changed or not depends on the policies set up by identity administrator. This usually means that the password will be changed if it makes sense for the current situation and settings. This is the reasonable default choice.</li><li><span class="fa fa-square-o"/> Password will not be changed for this system.</li></ul><p>You can adjust the password propagation settings by clicking on the icons and thus fine-tune how the password change is propagated to each individual system.</p>
ChangePasswordPanel.helpInfo=<p>This portion of the credentials dialog controls how the password change will be propagated to each individual system. The first line defines whether the password will be changed in the midPoint itself. Following lines represent each system for which the password can be changed. The password propagation is controlled by the icons:</p><ul><li><span class="fa fa-check-square-o"/> Password will be changed. Password for this system will be changed to the value specified in the password dialog above.</li><li><span class="fa fa-sign-out"/> Automatic password propagation. The password might be changed. Whether the password is changed or not depends on the policies set up by identity administrator. This usually means that the password will be changed if it makes sense for the current situation and settings. This is the reasonable default choice.</li><li><span class="fa fa-square-o"/> Password will not be changed for this system.</li></ul><p>You can adjust the password propagation settings by clicking on the icons and thus fine-tune how the password change is propagated to each individual system.</p>
ChangePasswordPanel.helpPopupTitle=Password propagation help
PageBase.button.tooltip.clearSearch=Clear
mainForm.uploadTooLarge = Upload must be less than ${maxSize}.
Expand Down
Expand Up @@ -3058,7 +3058,7 @@ ChangePasswordPanel.enabled=Enabled
ChangePasswordPanel.legendMessage.selected= - Password will be changed
ChangePasswordPanel.legendMessage.propagated= - Automatic password propagation (based on policies defined in resources definitions)
ChangePasswordPanel.legendMessage.deselected= - Password will not be changed
ChangePasswordPanel.helpInfo=<p>This portion of the credentials dialog controls how the password change will be propagated to each individual system. The first line defines whether the password will be changes in the midPoint itself. Following lines represent each system for which the password can be changed. The password propagation is controlled by the icons\:</p><ul><li><span class\="fa fa-check-square-o"/> Password will be changed. Password for this system will be changed to the value specified in the password dialog above.</li><li><span class\="fa fa-sign-out"/> Automatic password propagation. The password might be changed. Whether the password is changed or not depends on the policies set up by identity administrator. This usually means that the password will be changed if it makes sense for the current situation and settings. This is the reasonable default choice.</li><li><span class\="fa fa-square-o"/> Password will not be changed for this system.</li></ul><p>You can adjust the password propagation settings by clicking on the icons and thus fine-tune how the password change is propagated to each individual system.</p>
ChangePasswordPanel.helpInfo=<p>This portion of the credentials dialog controls how the password change will be propagated to each individual system. The first line defines whether the password will be changed in the midPoint itself. Following lines represent each system for which the password can be changed. The password propagation is controlled by the icons\:</p><ul><li><span class\="fa fa-check-square-o"/> Password will be changed. Password for this system will be changed to the value specified in the password dialog above.</li><li><span class\="fa fa-sign-out"/> Automatic password propagation. The password might be changed. Whether the password is changed or not depends on the policies set up by identity administrator. This usually means that the password will be changed if it makes sense for the current situation and settings. This is the reasonable default choice.</li><li><span class\="fa fa-square-o"/> Password will not be changed for this system.</li></ul><p>You can adjust the password propagation settings by clicking on the icons and thus fine-tune how the password change is propagated to each individual system.</p>
ChangePasswordPanel.helpPopupTitle=Password propagation help
PageBase.button.tooltip.clearSearch=Clear
mainForm.uploadTooLarge = Upload must be less than ${maxSize}.
Expand Down
Expand Up @@ -162,12 +162,18 @@ <T extends ShadowType> PrismObject<T> convertToResourceObject(ConnectorObject co
if (icfAttr.getName().equals(OperationalAttributes.PASSWORD_NAME)) {
// password has to go to the credentials section
ProtectedStringType password = getSingleValue(icfAttr, ProtectedStringType.class);
if (password == null) {
continue;
}
ShadowUtil.setPassword(shadow, password);
LOGGER.trace("Converted password: {}", password);
continue;
}
if (icfAttr.getName().equals(OperationalAttributes.ENABLE_NAME)) {
Boolean enabled = getSingleValue(icfAttr, Boolean.class);
if (enabled == null) {
continue;
}
ActivationType activationType = ShadowUtil.getOrCreateActivation(shadow);
ActivationStatusType activationStatusType;
if (enabled) {
Expand All @@ -183,20 +189,29 @@ <T extends ShadowType> PrismObject<T> convertToResourceObject(ConnectorObject co

if (icfAttr.getName().equals(OperationalAttributes.ENABLE_DATE_NAME)) {
Long millis = getSingleValue(icfAttr, Long.class);
if (millis == null) {
continue;
}
ActivationType activationType = ShadowUtil.getOrCreateActivation(shadow);
activationType.setValidFrom(XmlTypeConverter.createXMLGregorianCalendar(millis));
continue;
}

if (icfAttr.getName().equals(OperationalAttributes.DISABLE_DATE_NAME)) {
Long millis = getSingleValue(icfAttr, Long.class);
if (millis == null) {
continue;
}
ActivationType activationType = ShadowUtil.getOrCreateActivation(shadow);
activationType.setValidTo(XmlTypeConverter.createXMLGregorianCalendar(millis));
continue;
}

if (icfAttr.getName().equals(OperationalAttributes.LOCK_OUT_NAME)) {
Boolean lockOut = getSingleValue(icfAttr, Boolean.class);
if (lockOut == null) {
continue;
}
if (lockOut != null){
ActivationType activationType = ShadowUtil.getOrCreateActivation(shadow);
LockoutStatusType lockoutStatusType;
Expand Down

0 comments on commit 7adc33a

Please sign in to comment.