use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.
the class CreatePassword method validateAndSetUserExtSources.
/**
* Validates password and sets user ext sources
*
* @param userId user to set password for
* @param login used for validation only
* @param namespace defined login in namespace
*/
public void validateAndSetUserExtSources(int userId, String login, String namespace) {
this.userId = userId;
this.namespace = namespace;
this.login = login;
// test arguments
String errorMsg = "";
if (userId == 0) {
errorMsg += "<p>User ID can't be 0.";
}
if (namespace.isEmpty()) {
errorMsg += "<p>Namespace can't be empty.";
}
if (login.isEmpty()) {
errorMsg += "<p>Login to create password for can't be empty.";
}
if (errorMsg.length() > 0) {
Confirm c = new Confirm("Error while creating password.", new HTML(errorMsg), true);
c.show();
return;
}
JsonPostClient jspc = new JsonPostClient(events);
jspc.sendData(JSON_URL_VALIDATE_AND_SET_USER_EXT_SOURCE, validateCallJSON());
}
use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.
the class RemoveUserExtSource method testRemoving.
/**
* Tests the values, if the process can continue
*
* @return true/false for continue/stop
*/
private boolean testRemoving() {
boolean result = true;
String errorMsg = "";
if (userId == 0) {
errorMsg += "Wrong parameter <strong>User ID</strong>. ";
result = false;
}
if (uesId == 0) {
errorMsg += "Wrong parameter <strong>User Ext Source ID</strong>. ";
result = false;
}
if (errorMsg.length() > 0) {
Confirm c = new Confirm("Error while adding user external source", new HTML(errorMsg), true);
c.show();
}
return result;
}
use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.
the class CreateVo method testCreating.
/**
* Tests the values, if the process can continue
*
* @return
*/
private boolean testCreating() {
boolean result = true;
String errorMsg = "";
if (name.length() == 0) {
errorMsg += "You must fill in the parameter <strong>Name</strong>.<br />";
result = false;
}
if (shortName.length() == 0) {
errorMsg += "You must fill in the parameter <strong>Short name</strong>.<br />";
result = false;
}
if (errorMsg.length() > 0) {
Confirm c = new Confirm("Error while creating VO", new HTML(errorMsg), true);
c.show();
}
return result;
}
use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.
the class AddUserExtSource method testAdding.
/**
* Tests the values, if the process can continue
*
* @return true/false for continue/stop
*/
private boolean testAdding() {
boolean result = true;
String errorMsg = "";
if (userId == 0) {
errorMsg += "Wrong parameter <strong>User ID</strong>.\n";
result = false;
}
if (errorMsg.length() > 0) {
Confirm c = new Confirm("Error while adding user external source", new HTML(errorMsg), true);
c.show();
}
return result;
}
use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.
the class CreatePassword method createRandomPassword.
/**
* Create empty password for the user - random password is generated on KDC side
*
* @param userId user to set password for
* @param login used for validation only
* @param namespace defined login in namespace
*/
public void createRandomPassword(int userId, String login, String namespace) {
this.userId = userId;
this.namespace = namespace;
this.login = login;
// test arguments
String errorMsg = "";
if (userId == 0) {
errorMsg += "<p>User ID can't be 0.";
}
if (namespace.isEmpty()) {
errorMsg += "<p>Namespace can't be empty.";
}
if (login.isEmpty()) {
errorMsg += "<p>Login to create password for can't be empty.";
}
if (errorMsg.length() > 0) {
Confirm c = new Confirm("Error while creating password.", new HTML(errorMsg), true);
c.show();
return;
}
// final events
final JsonCallbackEvents newEvents = new JsonCallbackEvents() {
@Override
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Creating password failed.");
// custom events
events.onError(error);
}
@Override
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("Password created successfully.");
events.onFinished(jso);
}
};
// validate event
JsonCallbackEvents validateEvent = new JsonCallbackEvents() {
@Override
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Creating password failed.");
// custom events
events.onError(error);
}
@Override
public void onFinished(JavaScriptObject jso) {
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL_VALIDATE, validateCallJSON());
}
@Override
public void onLoadingStart() {
events.onLoadingStart();
}
};
// sending data
JsonPostClient jspc = new JsonPostClient(validateEvent);
jspc.sendData(JSON_URL_RESERVE_RANDOM, prepareJSONObject());
}
Aggregations