use of com.google.gwt.http.client.RequestException in project pentaho-platform by pentaho.
the class UserRolesAdminPanelController method activate.
// -- ISysAdminPanel implementation.
public void activate() {
processLDAPOrJDBCmode();
initializeActionBaseSecurityElements();
initializeAvailableUsers(null);
final String url = GWT.getHostPageBaseURL() + "api/system/authentication-provider";
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.GET, url);
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
executableTypesRequestBuilder.setHeader("accept", "application/json");
try {
executableTypesRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
}
public void onResponseReceived(Request request, Response response) {
boolean usingPentahoSecurity = response.getText().contains("jackrabbit");
if (!usingPentahoSecurity) {
initializeRoles(null, "api/userrolelist/roles?addExtraRoles=false", rolesListBox);
} else {
initializeRoles(null, "api/userroledao/roles", rolesListBox);
}
initializeRoles(null, "api/userrolelist/extraRoles", systemRolesListBox);
}
});
} catch (RequestException e) {
// ignored
}
}
use of com.google.gwt.http.client.RequestException in project pentaho-platform by pentaho.
the class UserRolesAdminPanelController method saveRole.
public void saveRole(final String name) {
String serviceUrl = GWT.getHostPageBaseURL() + "api/userroledao/createRole?roleName=" + encodeUri(name);
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.PUT, serviceUrl);
try {
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
executableTypesRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
displayErrorInMessageBox(Messages.getString("Error"), exception.getLocalizedMessage());
}
public void onResponseReceived(Request request, Response response) {
initializeRoles(name, "api/userroledao/roles", rolesListBox);
initializeAvailableUsers(usersListBox.getValue(usersListBox.getSelectedIndex()));
}
});
} catch (RequestException e) {
displayErrorInMessageBox(Messages.getString("Error"), e.getLocalizedMessage());
}
}
use of com.google.gwt.http.client.RequestException in project pentaho-platform by pentaho.
the class UserRolesAdminPanelController method updatePassword.
public void updatePassword(String newPassword, String administratorPassword, final ServiceCallback callback) {
String userName = usersListBox.getValue(usersListBox.getSelectedIndex());
String serviceUrl = GWT.getHostPageBaseURL() + "api/userroledao/updatePassword";
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.PUT, serviceUrl);
try {
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
executableTypesRequestBuilder.setHeader("Content-Type", "application/json");
String json = "{\"userName\": \"" + encodeUri(userName) + "\", \"password\": \"" + encodeUri(newPassword) + "\", \"administratorPassword\": \"" + encodeUri(administratorPassword) + "\"}";
executableTypesRequestBuilder.sendRequest(json, new RequestCallback() {
public void onError(Request request, Throwable exception) {
showXulErrorMessage(Messages.getString("changePasswordErrorTitle"), Messages.getString("changePasswordErrorMessage"));
callback.serviceResult(false);
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() != Response.SC_OK) {
showXulErrorMessage(Messages.getString("changePasswordErrorTitle"), Messages.getString("changePasswordErrorMessage"));
callback.serviceResult(false);
} else {
callback.serviceResult(true);
}
}
});
} catch (RequestException e) {
showXulErrorMessage(Messages.getString("changePasswordErrorTitle"), Messages.getString("changePasswordErrorMessage"));
callback.serviceResult(false);
}
}
use of com.google.gwt.http.client.RequestException in project pentaho-platform by pentaho.
the class AbstractFilePropertiesCommand method performOperation.
public void performOperation() {
final SolutionFileActionEvent event = new SolutionFileActionEvent();
event.setAction(this.getClass().getName());
if (getRepositoryFile() != null) {
final RepositoryFile item = getRepositoryFile();
// Checking if the user has access to manage permissions
String url = contextURL + "api/repo/files/" + SolutionBrowserPanel.pathToId(item.getPath()) + "/canAccess?permissions=" + // $NON-NLS-1$ //$NON-NLS-2$
MANAGE_ACLS;
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
try {
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
FilePropertiesDialog dialog = new FilePropertiesDialog(item, new PentahoTabPanel(), null, getActiveTab(), false);
dialog.showTab(getActiveTab());
dialog.center();
event.setMessage(exception.getMessage());
EventBusUtil.EVENT_BUS.fireEvent(event);
}
public void onResponseReceived(Request request, Response response) {
FilePropertiesDialog dialog = new FilePropertiesDialog(item, new PentahoTabPanel(), null, getActiveTab(), Boolean.parseBoolean(response.getText()));
dialog.showTab(getActiveTab());
dialog.center();
event.setMessage("Success");
EventBusUtil.EVENT_BUS.fireEvent(event);
}
});
} catch (RequestException e) {
FilePropertiesDialog dialog = new FilePropertiesDialog(item, new PentahoTabPanel(), null, getActiveTab(), false);
dialog.showTab(getActiveTab());
dialog.center();
event.setMessage(e.getMessage());
EventBusUtil.EVENT_BUS.fireEvent(event);
}
}
}
use of com.google.gwt.http.client.RequestException in project pentaho-platform by pentaho.
the class CollapseBrowserCommand method performOperation.
protected void performOperation(boolean feedback) {
final SolutionBrowserPanel solutionBrowserPerspective = SolutionBrowserPanel.getInstance();
if (!solutionBrowserPerspective.isNavigatorShowing()) {
PerspectiveManager.getInstance().setPerspective(PerspectiveManager.OPENED_PERSPECTIVE);
}
solutionBrowserPerspective.setNavigatorShowing(false);
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/user-settings/MANTLE_SHOW_NAVIGATOR";
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
try {
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
builder.sendRequest("false", EmptyRequestCallback.getInstance());
} catch (RequestException e) {
// showError(e);
}
}
Aggregations