Search in sources :

Example 21 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class DisasterRecovery method switchover.

@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void switchover(String id) {
    String standby_name = null;
    String standby_vip = null;
    String active_name = null;
    Boolean isSwitchover = false;
    // Get active site details
    SiteRestRep activesite = DisasterRecoveryUtils.getActiveSite();
    active_name = activesite == null ? "N/A" : activesite.getName();
    SiteRestRep result = DisasterRecoveryUtils.getSite(id);
    if (result != null) {
        // Check Switchover or Failover
        SiteActive currentSite = DisasterRecoveryUtils.checkActiveSite();
        if (currentSite.getIsActive() == true) {
            DisasterRecoveryUtils.doSwitchover(id);
            isSwitchover = true;
        } else {
            DisasterRecoveryUtils.doFailover(id);
            isSwitchover = false;
        }
        standby_name = result.getName();
        standby_vip = result.getVipEndpoint();
    }
    String site_uuid = id;
    maintenance(active_name, standby_name, standby_vip, site_uuid, isSwitchover);
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) SiteActive(com.emc.storageos.model.dr.SiteActive) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 22 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class DisasterRecovery method edit.

@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void edit(String id) {
    SiteRestRep siteRest = DisasterRecoveryUtils.getSite(id);
    if (siteRest != null) {
        DisasterRecoveryForm disasterRecovery = new DisasterRecoveryForm(siteRest);
        edit(disasterRecovery);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) Restrictions(controllers.deadbolt.Restrictions)

Example 23 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class DisasterRecovery method resume.

@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN"), @Restrict("SYSTEM_ADMIN"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void resume(String id) {
    SiteRestRep result = DisasterRecoveryUtils.getSite(id);
    if (result != null) {
        SiteRestRep siteresume = DisasterRecoveryUtils.resumeStandby(id);
        flash.success(MessagesUtils.get(RESUMED_SUCCESS, siteresume.getName()));
    }
    list();
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 24 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class VirtualDataCenters method save.

@FlashException(keep = true, referrer = { "create", "edit" })
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void save(VirtualDataCenterForm vdc) {
    vdc.validate("vdc");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    if (vdc.isNew()) {
        VirtualDataCenterAddParam vdcToAdd = new VirtualDataCenterAddParam();
        vdcToAdd.setName(vdc.name);
        vdcToAdd.setApiEndpoint(vdc.apiEndpoint);
        vdcToAdd.setDescription(vdc.description);
        vdcToAdd.setSecretKey(vdc.secretKey);
        try {
            vdcToAdd.setCertificateChain(FileUtils.readFileToString(vdc.certChain));
        } catch (Exception e) {
            flash.error(MessagesUtils.get("vdc.certChain.invalid.error"));
            Common.handleError();
        }
        Task<VirtualDataCenterRestRep> task = VirtualDataCenterUtils.create(vdcToAdd);
        flash.put("inProgressTask", task.getTaskResource().getId());
    } else {
        VirtualDataCenterRestRep currentVDC = VirtualDataCenterUtils.get(vdc.id);
        if (currentVDC != null) {
            VirtualDataCenterModifyParam vdcToUpdate = new VirtualDataCenterModifyParam();
            vdcToUpdate.setName(vdc.name);
            vdcToUpdate.setDescription(vdc.description);
            Task<VirtualDataCenterRestRep> task = VirtualDataCenterUtils.update(uri(vdc.id), vdcToUpdate);
            flash.put("inProgressTask", task.getTaskResource().getId());
        }
    }
    Cache.delete(Common.VDCS);
    if (StringUtils.isNotBlank(vdc.referrerUrl)) {
        redirect(vdc.referrerUrl);
    } else {
        list();
    }
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) VirtualDataCenterAddParam(com.emc.storageos.model.vdc.VirtualDataCenterAddParam) FlashException(controllers.util.FlashException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) VirtualDataCenterModifyParam(com.emc.storageos.model.vdc.VirtualDataCenterModifyParam) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 25 with Restrictions

use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.

the class StorageOSDeadboltHandler method getRoleSetsFromController.

/*
     * Query the roles required by the deadbolt annotations. This is used for logging purposes to show what the controller
     * requires.
     */
private static List<String> getRoleSetsFromController() {
    List<String> roleSets = Lists.newArrayList();
    Restrictions restrictions = getActionAnnotation(Restrictions.class);
    if (restrictions == null) {
        restrictions = getControllerInheritedAnnotation(Restrictions.class);
    }
    if (restrictions != null) {
        Restrict[] restrictArray = restrictions.value();
        for (int i = 0; i < restrictArray.length; i++) {
            roleSets.add(StringUtils.join(restrictArray[i].value(), " & "));
        }
    }
    Restrict restrict = getActionAnnotation(Restrict.class);
    if (restrict == null) {
        restrict = getControllerInheritedAnnotation(Restrict.class);
    }
    if (restrict != null) {
        roleSets.add(StringUtils.join(restrict.value(), " & "));
    }
    return roleSets;
}
Also used : Restrict(controllers.deadbolt.Restrict) Restrictions(controllers.deadbolt.Restrictions)

Aggregations

Restrictions (controllers.deadbolt.Restrictions)29 FlashException (controllers.util.FlashException)8 SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)7 BackupDataTable (models.datatable.BackupDataTable)4 RoleAssignmentEntry (com.emc.storageos.model.auth.RoleAssignmentEntry)2 SiteIdListParam (com.emc.storageos.model.dr.SiteIdListParam)2 VirtualDataCenterRestRep (com.emc.storageos.model.vdc.VirtualDataCenterRestRep)2 ViPRSystemClient (com.emc.vipr.client.ViPRSystemClient)2 BackupRestoreStatus (com.emc.vipr.model.sys.backup.BackupRestoreStatus)2 NodeHealth (com.emc.vipr.model.sys.healthmonitor.NodeHealth)2 RecoveryStatus (com.emc.vipr.model.sys.recovery.RecoveryStatus)2 Date (java.util.Date)2 RebootNodeJob (jobs.RebootNodeJob)2 TenantRoleAssignmentDataTable (models.datatable.TenantRoleAssignmentDataTable)2 DateTime (org.joda.time.DateTime)2 RoleAssignmentUtils.createRoleAssignmentEntry (util.RoleAssignmentUtils.createRoleAssignmentEntry)2 SiteActive (com.emc.storageos.model.dr.SiteActive)1 SiteAddParam (com.emc.storageos.model.dr.SiteAddParam)1 SiteDetailRestRep (com.emc.storageos.model.dr.SiteDetailRestRep)1 SiteUpdateParam (com.emc.storageos.model.dr.SiteUpdateParam)1