Skip to content

Commit

Permalink
fix for MID-9093 Self-service Update attributes redirects to wrong link
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Sep 19, 2023
1 parent 4bf8b35 commit ffd2d2d
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper;
import com.evolveum.midpoint.gui.api.util.WebPrismUtil;
import com.evolveum.midpoint.gui.impl.component.menu.LeftMenuAuthzUtil;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -362,13 +364,28 @@ protected void postProcessResult(OperationResult result,

protected void navigateAction() {
Class<? extends PageBase> objectListPage = DetailsPageUtil.getObjectListPage(getType());
if (!canRedirectBack() && DetailsPageUtil.getObjectListPage(getType()) != null) {
var pageClass = DetailsPageUtil.getObjectListPage(getType());
if (!canRedirectBack() && pageClass != null && isAuthorized(pageClass)) {
navigateToNext(objectListPage);
} else {
redirectBack();
}
}

private boolean isAuthorized(Class<? extends PageBase> pageClass) {
try {
List<String> pageAuths = LeftMenuAuthzUtil.getAuthorizationsForPage(pageClass);
for (String auth : pageAuths) {
if (!isAuthorized(auth)) {
return false;
}
}
} catch (Exception e) {
//nothing to do here
}
return true;
}

protected Collection<ObjectDeltaOperation<? extends ObjectType>> executeChanges(Collection<ObjectDelta<? extends ObjectType>> deltas, boolean previewOnly, ExecuteChangeOptionsDto options, Task task, OperationResult result, AjaxRequestTarget target) {
if (noChangesToExecute(deltas, options)) {
if (!isShowedByWizard()) {
Expand Down

0 comments on commit ffd2d2d

Please sign in to comment.