summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuersat Akmaz2020-07-05 17:15:39 +0200
committerKuersat Akmaz2020-07-05 17:27:46 +0200
commit318b7f76be77f802f2d568e79cc6457e08203398 (patch)
tree69cab98b10455c6d836240f4fa319e47e3b4f706
parent[client] increase min height of vm configurator (diff)
downloadtutor-module-318b7f76be77f802f2d568e79cc6457e08203398.tar.gz
tutor-module-318b7f76be77f802f2d568e79cc6457e08203398.tar.xz
tutor-module-318b7f76be77f802f2d568e79cc6457e08203398.zip
[client] Disabled all unneccessary Buttons in ImageList
All Buttons which are unneccessary for the Student have been disabled in the Imagelist. Next Step is to do the same thing in Lecturelist. Issue : #3727
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java37
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java9
3 files changed, 49 insertions, 4 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
index 50034bf0..9afef44c 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
@@ -276,8 +276,14 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa
popupItemDownload.setEnabled(download);
popupItemNewLecture.setEnabled(link);
popupItemDelete.setEnabled(delete);
- btnEditDetails.setEnabled(selCount == 1);
- btnShowPublishedImages.setEnabled(true);
+ btnEditDetails.setEnabled(selCount == 1);
+
+ if (Session.isStudent())
+ {
+ deactiveUnnecessaryButtonsForStudents();
+ } else {
+ btnShowPublishedImages.setEnabled(true);
+ }
}
public void refresh(boolean force) {
@@ -403,6 +409,25 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa
ctlImageListViewer.refreshList(success, 1000);
}
+ /**
+ * This funtion disables all unnecessary buttons
+ * when Student is logged in.
+ */
+ public void deactiveUnnecessaryButtonsForStudents()
+ {
+ btnEditDetails.setVisible(false);
+ btnDelete.setVisible(false);
+ btnNewLecture.setVisible(false);
+ btnNewVm.setVisible(false);
+ btnShowPublishedImages.setVisible(false);
+
+ btnEditDetails.setEnabled(false);
+ btnDelete.setEnabled(false);
+ btnNewLecture.setEnabled(false);
+ btnNewVm.setEnabled(false);
+ btnShowPublishedImages.setEnabled(false);
+ }
+
/********************************************************************************
*
* CompositePage abstract methods implementation
@@ -418,7 +443,11 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa
// we need to enable the "Show published images" button here, since we need to check
// Session.getSatApiVersion() which is not set when this class is instantiated
ctlImageListViewer.refreshList(false, 1);
- btnShowPublishedImages.setVisible(Session.isImagePublishSupported());
+ if(Session.isStudent())
+ {
+ btnShowPublishedImages.setVisible(false);
+ } else {
+ btnShowPublishedImages.setVisible(Session.isImagePublishSupported());
+ }
}
-
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
index ef805799..e56bedae 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
@@ -16,6 +16,13 @@ public class MainMenuWindow extends MainMenuWindowLayout {
btnShowVirtualMachines.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
+
+ ImageListWindow Ilw = MainWindow.getPage(ImageListWindow.class);
+
+ if (Session.isStudent()){
+ Ilw.deactiveUnnecessaryButtonsForStudents();
+ }
+
MainWindow.showPage(ImageListWindow.class);
}
});
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
index aa43601e..8934620f 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
@@ -7,6 +7,7 @@ import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.bwlp.thrift.iface.LecturePermissions;
+import org.openslx.bwlp.thrift.iface.Role;
import org.openslx.bwlp.thrift.iface.SatelliteConfig;
import org.openslx.bwlp.thrift.iface.WhoamiInfo;
import org.openslx.sat.thrift.version.Feature;
@@ -82,6 +83,14 @@ public class Session {
return null;
return data.user.userId;
}
+ /**
+ * @return checks if user is Student
+ */
+ public static boolean isStudent() {
+ if (data == null)
+ return false;
+ return data.user.role == Role.STUDENT;
+ }
/**
* @return the organization id