Search in sources :

Example 26 with FlashException

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);
}
Also used : StringOption(util.StringOption) CertificateDataTable(models.datatable.CertificateDataTable) TruststoreSettings(com.emc.vipr.model.keystore.TruststoreSettings) FlashException(controllers.util.FlashException)

Example 27 with FlashException

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"));
}
Also used : KeyAndCertificateChain(com.emc.vipr.model.keystore.KeyAndCertificateChain) FlashException(controllers.util.FlashException) FlashException(controllers.util.FlashException)

Example 28 with FlashException

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));
}
Also used : AuthnProviderRestRep(com.emc.storageos.model.auth.AuthnProviderRestRep) FlashException(controllers.util.FlashException)

Example 29 with FlashException

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));
}
Also used : RoleAssignmentEntry(com.emc.storageos.model.auth.RoleAssignmentEntry) RoleAssignmentUtils.createRoleAssignmentEntry(util.RoleAssignmentUtils.createRoleAssignmentEntry) VDCRoleAssignmentDataTable(models.datatable.VDCRoleAssignmentDataTable) FlashException(controllers.util.FlashException)

Example 30 with FlashException

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();
    }
}
Also used : RoleAssignmentType(models.RoleAssignmentType) RoleAssignmentEntry(com.emc.storageos.model.auth.RoleAssignmentEntry) RoleAssignmentUtils.createRoleAssignmentEntry(util.RoleAssignmentUtils.createRoleAssignmentEntry) FlashException(controllers.util.FlashException)

Aggregations

FlashException (controllers.util.FlashException)122 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)45 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)9 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)9 URI (java.net.URI)9 ExportUpdateParam (com.emc.storageos.model.block.export.ExportUpdateParam)8 Restrictions (controllers.deadbolt.Restrictions)8 ArrayList (java.util.ArrayList)7 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)5 CopiesParam (com.emc.storageos.model.block.CopiesParam)4 SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)4 ExportRule (com.emc.storageos.model.file.ExportRule)4 ExportRules (com.emc.storageos.model.file.ExportRules)4 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)4 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)4 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)4 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)2