use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.
the class SystemHealth method getRecoveryStatus.
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void getRecoveryStatus() {
ViPRSystemClient client = BourneUtil.getSysClient();
RecoveryStatus recoveryStatus = client.control().getRecoveryStatus();
JsonElement jsonElement = new Gson().toJsonTree(recoveryStatus);
JsonObject jsonObj = jsonElement.getAsJsonObject();
if (recoveryStatus.getStartTime() != null) {
DateTime startTime = new DateTime(recoveryStatus.getStartTime().getTime());
jsonObj.addProperty("startTime", startTime.toString());
}
if (recoveryStatus.getEndTime() != null) {
DateTime endTime = new DateTime(recoveryStatus.getEndTime().getTime());
jsonObj.addProperty("endTime", endTime.toString());
}
renderJSON(jsonObj.toString());
}
use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.
the class SystemHealth method nodeReboot.
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void nodeReboot(@Required String nodeId) {
NodeHealth nodeHealth = MonitorUtils.getNodeHealth(nodeId);
String node = nodeId;
try {
node = MonitorUtils.getNodeHealth(nodeId).getNodeName();
} catch (NullPointerException e) {
Logger.warn("Could not determine node name.");
}
if (nodeHealth != null && nodeHealth.getStatus().equals("Good")) {
new RebootNodeJob(getSysClient(), nodeId).in(3);
flash.success(Messages.get("adminDashboard.nodeRebooting", node));
Maintenance.maintenance(Common.reverseRoute(SystemHealth.class, "systemHealth"));
} else {
flash.error(Messages.get("systemHealth.message.reboot.unavailable", node));
systemHealth();
}
}
use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.
the class DisasterRecovery method pause.
@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN"), @Restrict("SYSTEM_ADMIN"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void pause(@As(",") String[] ids) {
List<String> uuids = Arrays.asList(ids);
for (String uuid : uuids) {
if (!DisasterRecoveryUtils.hasStandbySite(uuid)) {
flash.error(MessagesUtils.get(UNKNOWN, uuid));
list(true);
}
}
SiteIdListParam param = new SiteIdListParam();
param.getIds().addAll(uuids);
try {
DisasterRecoveryUtils.pauseStandby(param);
} catch (ServiceErrorException ex) {
flash.error(ex.getDetailedMessage());
list(true);
} catch (Exception ex) {
flash.error(ex.getMessage());
list(true);
}
flash.success(MessagesUtils.get(PAUSED_SUCCESS));
list(true);
}
use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.
the class DisasterRecovery method create.
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void create() {
for (SiteRestRep site : DisasterRecoveryUtils.getSites()) {
if (SiteState.STANDBY_PAUSED.toString().equals(site.getState())) {
continue;
}
SiteDetailRestRep detail = DisasterRecoveryUtils.getSiteDetails(site.getUuid());
if (!ClusterInfo.ClusterState.STABLE.toString().equals(detail.getClusterState())) {
flash.error(MessagesUtils.get(ADD_WARNING, site.getName()));
list();
}
}
DisasterRecoveryForm site = new DisasterRecoveryForm();
edit(site);
}
use of controllers.deadbolt.Restrictions in project coprhd-controller by CoprHD.
the class DisasterRecovery method delete.
@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void delete(@As(",") String[] ids) {
List<String> uuids = Arrays.asList(ids);
for (String uuid : uuids) {
if (!DisasterRecoveryUtils.hasStandbySite(uuid)) {
flash.error(MessagesUtils.get(UNKNOWN, uuid));
list();
}
}
SiteIdListParam param = new SiteIdListParam();
param.getIds().addAll(uuids);
DisasterRecoveryUtils.deleteStandby(param);
flash.success(MessagesUtils.get(DELETED_SUCCESS));
list();
}
Aggregations