Search in sources :

Example 11 with Restrictions

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

the class VirtualDataCenters method edit.

@FlashException(value = "list", keep = true)
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void edit(String id) {
    VirtualDataCenterRestRep viprVDC = VirtualDataCenterUtils.get(id);
    if (viprVDC != null) {
        VirtualDataCenterForm vdc = new VirtualDataCenterForm().from(viprVDC);
        addRenderArgs();
        render(vdc);
    } else {
        flash.error(MessagesUtils.get("vdcs.unknown", id));
        list();
    }
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 12 with Restrictions

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

the class SystemHealth method minorityNodeRecovery.

@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void minorityNodeRecovery() {
    new MinorityNodeRecoveryJob(getSysClient()).in(3);
    ViPRSystemClient client = BourneUtil.getSysClient();
    List<NodeHealth> nodeHealthList = MonitorUtils.getNodeHealth();
    ClusterInfo clusterInfo = AdminDashboardUtils.getClusterInfo();
    if (PlatformUtils.isVMwareVapp()) {
        RecoveryPrecheckStatus recoveryPrecheckStatus = client.control().getRecoveryPrecheckStatus();
        String recoveringMsg = Messages.get("nodeRecovery.recovering.status", recoveryPrecheckStatus.getRecoverables().toString());
        renderArgs.put("recoveringMsg", recoveringMsg);
    }
    RecoveryStatus recoveryStatus = client.control().getRecoveryStatus();
    renderArgs.put("nodeHealthList", nodeHealthList);
    renderArgs.put("clusterInfo", clusterInfo);
    renderArgs.put("recoveryStatus", recoveryStatus);
    if (PlatformUtils.isVMwareVapp()) {
        render("@nodeRecoveryVapp");
    } else {
        render("@nodeRecovery");
    }
}
Also used : MinorityNodeRecoveryJob(jobs.MinorityNodeRecoveryJob) ViPRSystemClient(com.emc.vipr.client.ViPRSystemClient) ClusterInfo(com.emc.vipr.model.sys.ClusterInfo) RecoveryPrecheckStatus(com.emc.vipr.model.sys.recovery.RecoveryPrecheckStatus) RecoveryStatus(com.emc.vipr.model.sys.recovery.RecoveryStatus) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth) Restrictions(controllers.deadbolt.Restrictions)

Example 13 with Restrictions

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

the class SystemHealth method serviceRestart.

@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void serviceRestart(@Required String nodeId, @Required String serviceName) {
    new RestartServiceJob(getSysClient(), serviceName, nodeId).in(3);
    String node = nodeId;
    try {
        node = MonitorUtils.getNodeHealth(nodeId).getNodeName();
    } catch (NullPointerException e) {
        Logger.warn("Could not determine node name.");
    }
    flash.success(Messages.get("adminDashboard.serviceRestarting", serviceName, node));
    Maintenance.maintenance(Common.reverseRoute(SystemHealth.class, "services", "nodeId", nodeId));
}
Also used : RestartServiceJob(jobs.RestartServiceJob) Restrictions(controllers.deadbolt.Restrictions)

Example 14 with Restrictions

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

the class Backup method externalStatusJson.

/**
 * Only get the remote restore status
 * @param ids
 */
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SYSTEM_MONITOR"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void externalStatusJson(@As(",") String[] ids) {
    List<BackupDataTable.Backup> results = Lists.newArrayList();
    for (String id : ids) {
        if (StringUtils.isNotBlank(id)) {
            BackupDataTable.Backup backup = new BackupDataTable.Backup(id, false);
            BackupRestoreStatus restoreStatus = BackupUtils.getRestoreStatus(id, false);
            backup.status = restoreStatus.getStatus().name();
            if (restoreStatus.getStatus() == BackupRestoreStatus.Status.RESTORE_FAILED) {
                backup.error = restoreStatus.getDetails();
            }
            results.add(backup);
        }
    }
    renderJSON(results);
}
Also used : BackupDataTable(models.datatable.BackupDataTable) BackupRestoreStatus(com.emc.vipr.model.sys.backup.BackupRestoreStatus) Restrictions(controllers.deadbolt.Restrictions)

Example 15 with Restrictions

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

the class Backup method externalItemsJson.

/**
 * Only get the remote backup info
 * @param ids
 */
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SYSTEM_MONITOR"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void externalItemsJson(@As(",") String[] ids) {
    List<BackupDataTable.Backup> results = Lists.newArrayList();
    if (ids != null) {
        for (String id : ids) {
            if (StringUtils.isNotBlank(id)) {
                BackupInfo backupInfo = BackupUtils.getBackupInfo(id, false);
                BackupDataTable.Backup backup = new BackupDataTable.Backup(id, false);
                backup.creationtime = backupInfo.getCreateTime();
                backup.sitename = backupInfo.getSiteName();
                backup.version = backupInfo.getVersion();
                backup.size = backupInfo.getBackupSize();
                results.add(backup);
            }
        }
    }
    renderJSON(results);
}
Also used : BackupInfo(com.emc.vipr.model.sys.backup.BackupInfo) BackupDataTable(models.datatable.BackupDataTable) 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