use of com.willshex.blogwt.shared.api.user.call.ChangeUserAccessResponse in project blogwt by billy1380.
the class UserService method changeUserAccess.
public Request changeUserAccess(ChangeUserAccessRequest input, AsyncSuccess<ChangeUserAccessRequest, ChangeUserAccessResponse> onSuccess, AsyncFailure<ChangeUserAccessRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(UserMethodChangeUserAccess, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
ChangeUserAccessResponse outputParameter = new ChangeUserAccessResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(UserService.this, UserMethodChangeUserAccess, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodChangeUserAccess, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodChangeUserAccess, input, exception);
}
});
onCallStart(UserService.this, UserMethodChangeUserAccess, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodChangeUserAccess, input, exception);
}
return handle;
}
use of com.willshex.blogwt.shared.api.user.call.ChangeUserAccessResponse in project blogwt by billy1380.
the class UserController method changeUserAccess.
private void changeUserAccess(Boolean revoke, User user, List<Permission> permissions, List<Role> roles, Boolean suspend, Date suspendUntil) {
final ChangeUserAccessRequest input = ApiHelper.setAccessCode(new ChangeUserAccessRequest());
input.session = SessionController.get().sessionForApiCall();
input.user = user;
input.revoke = revoke;
input.roles = roles;
input.permissions = permissions;
input.suspend = suspend;
input.suspendUntil = suspendUntil;
ApiHelper.createUserClient().changeUserAccess(input, new AsyncCallback<ChangeUserAccessResponse>() {
@Override
public void onSuccess(ChangeUserAccessResponse output) {
if (output.status == StatusType.StatusTypeSuccess) {
}
DefaultEventBus.get().fireEventFromSource(new ChangeUserAccessSuccess(input, output), UserController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new ChangeUserAccessFailure(input, caught), UserController.this);
}
});
}
Aggregations