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 21, 2023
1 parent c7b4dac commit 2d6c00c
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.evolveum.midpoint.gui.impl.component.menu.LeftMenuAuthzUtil;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -310,13 +311,28 @@ protected void postProcessResult(OperationResult result,

protected void navigateAction() {
Class<? extends PageBase> objectListPage = WebComponentUtil.getObjectListPage(getType());
if (!canRedirectBack() && WebComponentUtil.getObjectListPage(getType()) != null) {
var pageClass = WebComponentUtil.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 2d6c00c

Please sign in to comment.