use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.
the class AddSpecificUserOwner method addSpecificUser.
/**
* Create connection between user and service/specific user
*
* @param user
* @param specificUser
*/
public void addSpecificUser(final User user, final User specificUser) {
this.user = user;
this.specificUser = specificUser;
// test arguments
if (!this.testAdding()) {
return;
}
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Adding " + specificUser.getFullName() + " to user: " + user.getFullName() + " failed.");
// custom events
events.onError(error);
}
;
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("Service identity: " + specificUser.getFullName() + " added to user: " + user.getFullName());
events.onFinished(jso);
}
;
public void onLoadingStart() {
events.onLoadingStart();
}
;
};
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, prepareJSONObject());
}
use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.
the class ChangeNonAuthzPassword method changeNonAuthzPassword.
/**
* Changes password for the user
*
* @param i encrypted value 1
* @param m encrypted value 2
* @param password new password to set
*/
public void changeNonAuthzPassword(String i, String m, String password) {
this.i = i;
this.m = m;
this.password = password;
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Changing password failed.");
// custom events
events.onError(error);
}
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("Password changed successfully.");
events.onFinished(jso);
}
public void onLoadingStart() {
events.onLoadingStart();
}
};
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, prepareJSONObject());
}
use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.
the class ChangePassword method changePassword.
/**
* Changes password for the user
*
* @param user User to change password for
* @param loginNamespace Login namespace
* @param oldPassword Old password for comparing
* @param newPassword New password
*/
public void changePassword(User user, String loginNamespace, String oldPassword, String newPassword) {
this.user = user;
this.loginNamespace = loginNamespace;
this.oldPassword = oldPassword;
this.newPassword = newPassword;
// test arguments
if (!this.testAdding()) {
return;
}
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Changing password failed.");
// custom events
events.onError(error);
}
;
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("Password changed successfully.");
events.onFinished(jso);
}
;
public void onLoadingStart() {
events.onLoadingStart();
}
;
};
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, prepareJSONObject());
}
use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.
the class CreateCompleteService method createCompleteService.
/**
* Attempts to create a new Service including both ExecServices with dependency,
* it first tests the values and then submits them.
*
* @param name service Name
* @param scriptPath Path to the service script, default "./service_name"
* @param defaultDelay Delay in minutes when service is rescheduled (10 min is default)
* @param enabled TRUE if service should be enabled
*/
public void createCompleteService(final String name, final String scriptPath, final int defaultDelay, final boolean enabled) {
this.serviceName = name;
this.scriptPath = scriptPath;
this.defaultDelay = defaultDelay;
this.enabled = enabled;
// test arguments
if (!this.testCreating()) {
return;
}
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Creating service " + serviceName + " failed.");
// custom events
events.onError(error);
}
;
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("Service " + serviceName + " created.");
events.onFinished(jso);
}
;
public void onLoadingStart() {
events.onLoadingStart();
}
;
};
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, prepareJSONObject());
}
use of cz.metacentrum.perun.webgui.model.PerunError in project perun by CESNET.
the class CreateServicePackage method createServicePackage.
/**
* Attempts to create a new ServicesPackage, it first tests the values and then submits them.
*
* @param name service package name
* @param description service package description
*/
public void createServicePackage(final String name, final String description) {
this.packageName = name;
this.packageDescription = description;
// test arguments
if (!this.testCreating()) {
return;
}
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents() {
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Creating service package " + packageName + " failed.");
// custom events
events.onError(error);
}
;
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("Service package " + packageName + " created.");
events.onFinished(jso);
}
;
public void onLoadingStart() {
events.onLoadingStart();
}
;
};
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, prepareJSONObject());
}
Aggregations