use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class Certificates method list.
@FlashException
public static void list() {
CertificateDataTable dataTable = new CertificateDataTable();
List<StringOption> options = Lists.newArrayList();
options.add(new StringOption("true", MessagesUtils.get("common.yes")));
options.add(new StringOption("false", MessagesUtils.get("common.no")));
TruststoreSettings certificateSettings = null;
certificateSettings = api().getTruststoreSettings();
angularRenderArgs().putAll(ImmutableMap.of("options", options, "certificateSettings", certificateSettings));
render(dataTable);
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class Keystores method save.
@FlashException(value = "updateCertificate", keep = true)
public static void save(KeystoreForm keystore) {
keystore.validate("keystore");
if (Validation.hasErrors()) {
handleError(keystore);
}
if (keystore.rotate) {
try {
// Here we need a sync call. Else no way to catch exception
api().regenerateKeyAndCertificate();
} catch (Exception e) {
flash.error(e.getMessage());
handleError(keystore);
}
} else {
String key = null;
String cert = null;
try {
key = FileUtils.readFileToString(keystore.certKey);
} catch (Exception e) {
flash.error(MessagesUtils.get("keystore.certKey.invalid.error"));
handleError(keystore);
}
try {
cert = FileUtils.readFileToString(keystore.certChain);
} catch (Exception e) {
flash.error(MessagesUtils.get("keystore.certChain.invalid.error"));
handleError(keystore);
}
try {
KeyAndCertificateChain keyAndCertChain = new KeyAndCertificateChain();
keyAndCertChain.setCertificateChain(cert);
keyAndCertChain.setPrivateKey(key);
api().setKeyAndCertificateChain(keyAndCertChain);
} catch (Exception e) {
flash.error(e.getMessage());
handleError(keystore);
}
}
flash.success(MessagesUtils.get("keystore.saved.reboot"));
Maintenance.maintenance(Common.reverseRoute(Keystores.class, "updateCertificate"));
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class LDAPsources method edit.
@FlashException("list")
public static void edit(String id) {
AuthnProviderRestRep authnProvider = AuthnProviderUtils.getAuthnProvider(id);
if (authnProvider == null) {
flash.error(MessagesUtils.get(UNKNOWN, id));
list();
}
authProviderAutoReg = authnProvider.getAutoRegCoprHDNImportOSProjects();
edit(new LDAPsourcesForm(authnProvider));
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class VDCRoleAssignments method listJson.
@FlashException("list")
public static void listJson() {
List<RoleAssignmentEntry> viprRoleAssignments = getVDCRoleAssignments();
List<VDCRoleAssignmentDataTable.RoleInfo> roles = Lists.newArrayList();
for (RoleAssignmentEntry viprRoleAssignment : viprRoleAssignments) {
roles.add(new VDCRoleAssignmentDataTable.RoleInfo(viprRoleAssignment));
}
renderJSON(DataTablesSupport.createJSON(roles, params));
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class VDCRoleAssignments method edit.
@FlashException("list")
public static void edit(@Required String id) {
String name = VDCRoleAssignmentForm.extractNameFromId(id);
RoleAssignmentType type = VDCRoleAssignmentForm.extractTypeFromId(id);
RoleAssignmentEntry roleAssignmentEntry = getVDCRoleAssignment(name, type);
if (roleAssignmentEntry != null) {
addRolesToRenderArgs();
Boolean isRootUser = RoleAssignmentUtils.isRootUser(roleAssignmentEntry);
VDCRoleAssignmentForm roleAssignment = new VDCRoleAssignmentForm();
roleAssignment.id = id;
roleAssignment.readFrom(roleAssignmentEntry);
render(roleAssignment, isRootUser);
} else {
flash.error(MessagesUtils.get("roleAssignments.unknown", name));
list();
}
}
Aggregations