summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window
diff options
context:
space:
mode:
authorJonathan Bauer2018-04-26 12:03:19 +0200
committerJonathan Bauer2018-04-26 12:03:19 +0200
commit39bb87f9e2eacf204438f778fc92b99847dc8101 (patch)
treedafc8a45f9a4389296ca2ae9039a1c006bf3501b /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window
parentformatting (diff)
downloadtutor-module-39bb87f9e2eacf204438f778fc92b99847dc8101.tar.gz
tutor-module-39bb87f9e2eacf204438f778fc92b99847dc8101.tar.xz
tutor-module-39bb87f9e2eacf204438f778fc92b99847dc8101.zip
Prevent users from publishing non-vmware image
and filter non-vmware image out from the published image list in case they manage to somehow upload it anyway
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java8
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java13
2 files changed, 21 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
index 6ec350a3..d198e897 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
@@ -490,6 +490,14 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
* masterserver.
*/
private void uploadToMaster() {
+ // 04.2018: bail if we the user tries to publish a non-vmware image.
+ if (Session.hasFeature(Feature.MULTIPLE_HYPERVISORS) && image.virtId != TConst.VIRT_VMWARE) {
+ Gui.showMessageBox(
+ MetaDataCache.getVirtualizerById(image.virtId).virtName
+ + " ist derzeit nicht für den öffentlichen Austausch freigegeben.",
+ MessageType.ERROR, null, null);
+ return;
+ }
if (metadataChanged || permissionsChanged) {
if (Gui.showMessageBox("Sie haben unspeicherte Änderungen, wollen Sie diese erst speichern?",
MessageType.QUESTION_YESNO, null, null)) {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java
index 620d6bc7..3fc119ec 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java
@@ -41,6 +41,8 @@ import org.openslx.dozmod.thrift.ThriftError;
import org.openslx.dozmod.thrift.cache.ImagePublishedCache;
import org.openslx.dozmod.thrift.cache.OrganizationCache;
import org.openslx.dozmod.thrift.cache.UserCache;
+import org.openslx.sat.thrift.version.Feature;
+import org.openslx.thrifthelper.TConst;
import org.openslx.thrifthelper.ThriftManager;
import org.openslx.util.QuickTimer;
import org.openslx.util.QuickTimer.Task;
@@ -251,6 +253,17 @@ public class ImagePublishedWindow extends ImagePublishedWindowLayout implements
final List<ImageSummaryRead> imagePublishedList = ImagePublishedCache.get(forceRefresh);
if (imagePublishedList == null)
return;
+ // 04.2018: Safety check to hide the non-vmware images from the list
+ // in case they somehow manage to get published. Remove this when we
+ // support publishing images from other hypervisors.
+ if (Session.hasFeature(Feature.MULTIPLE_HYPERVISORS)) {
+ for (int i = 0; i < imagePublishedList.size(); i++) {
+ ImageSummaryRead current = imagePublishedList.get(i);
+ if (current.virtId != TConst.VIRT_VMWARE) {
+ imagePublishedList.remove(i);
+ }
+ }
+ }
Gui.asyncExec(new Runnable() {
@Override
public void run() {