try {
Workspace currentWorkspace = navigationManager.getCurrentWorkspace();
log.debug("currentWorkspace = " + (currentWorkspace == null ? "null" : currentWorkspace.getId()) + " workspaceCandidate = " + workspaceCandidate);
if (!workspace.equals(currentWorkspace)) {
WorkspacePermission workspacePerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_LOGIN);
if (userStatus.hasPermission(workspacePerm)) {
navigationManager.setCurrentWorkspace(workspace);
log.debug("SessionManager.setWorkspace(" + workspace.getId() + ")");
} else {
if (log.isDebugEnabled()) log.debug("User has no " + WorkspacePermission.ACTION_LOGIN + " permission in workspace " + workspaceCandidate);
if (isShowLoginBackDoorOnPermissionDenied()) {
navigationManager.setUserRequiresLoginBackdoor(true);
navigationManager.setCurrentWorkspace(workspace);
}
}
}
requestContext.consumeURIPart("/" + workspaceCandidate);
} catch (Exception e) {
log.error("Cannot set current workspace.", e);
}
}
// Check the user has access permissions to the target section.
else if (section != null) {
try {
if (!section.equals(navigationManager.getCurrentSection())) {
WorkspacePermission workspacePerm = WorkspacePermission.newInstance(section.getWorkspace(), WorkspacePermission.ACTION_LOGIN);
SectionPermission sectionPerm = SectionPermission.newInstance(section, SectionPermission.ACTION_VIEW);
if (userStatus.hasPermission(workspacePerm) && userStatus.hasPermission(sectionPerm)) {
if (log.isDebugEnabled()) log.debug("SessionManager.setSection(" + section.getId() + ")");
navigationManager.setCurrentSection(section);
}