Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport: Disable execution of CreateUserSession from GWT code #917

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.regex.Pattern;
Expand All @@ -17,6 +18,7 @@
import org.ovirt.engine.core.common.action.ActionReturnValue;
import org.ovirt.engine.core.common.action.ActionType;
import org.ovirt.engine.core.common.constants.SessionConstants;
import org.ovirt.engine.core.common.errors.EngineFault;
import org.ovirt.engine.core.common.interfaces.BackendLocal;
import org.ovirt.engine.core.common.queries.QueryParametersBase;
import org.ovirt.engine.core.common.queries.QueryReturnValue;
Expand Down Expand Up @@ -149,12 +151,21 @@ public List<ActionReturnValue> runMultipleActions(ActionType actionType,
ArrayList<ActionParametersBase> multipleParams, boolean isRunOnlyIfAllValidationPass, boolean isWaitForResult) {
log.debug("Server: RunMultipleAction invoked! [amount of actions: {}]", multipleParams.size()); //$NON-NLS-1$

// CreateUserSession should never be invoked from GWT code
if (actionType == ActionType.CreateUserSession) {
ActionReturnValue error = new ActionReturnValue();
error.setSucceeded(false);
error.setFault(new EngineFault(new RuntimeException("Command cannot be executed from client"))); //$NON-NLS-1$
return Arrays.asList(error);
}

String correlationId = CorrelationIdTracker.getCorrelationId();
for (ActionParametersBase params : multipleParams) {
params.setSessionId(getEngineSessionId());
if (params.getCorrelationId() == null) {
params.setCorrelationId(correlationId);
}

}

List<ActionReturnValue> returnValues =
Expand All @@ -168,6 +179,15 @@ public ActionReturnValue runAction(ActionType actionType,
ActionParametersBase params) {
log.debug("Server: RunAction invoked!"); //$NON-NLS-1$
debugAction(actionType, params);

// CreateUserSession should never be invoked from GWT code
if (actionType == ActionType.CreateUserSession) {
ActionReturnValue error = new ActionReturnValue();
error.setSucceeded(false);
error.setFault(new EngineFault(new RuntimeException("Command cannot be executed from client"))); //$NON-NLS-1$
return error;
}

params.setSessionId(getEngineSessionId());
if (params.getCorrelationId() == null) {
params.setCorrelationId(CorrelationIdTracker.getCorrelationId());
Expand Down
Loading