diff options
| author | Simon Rettberg | 2016-08-17 16:25:57 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2016-08-17 16:25:57 +0200 |
| commit | e82d9b24ef0e08f7f4e1cde79e7e30f539a4d0b3 (patch) | |
| tree | fec80480988dd9e7bbd7e1081a9413b907a70e03 /dozentenmodul/src | |
| parent | [client] fix bad condition (diff) | |
| download | tutor-module-e82d9b24ef0e08f7f4e1cde79e7e30f539a4d0b3.tar.gz tutor-module-e82d9b24ef0e08f7f4e1cde79e7e30f539a4d0b3.tar.xz tutor-module-e82d9b24ef0e08f7f4e1cde79e7e30f539a4d0b3.zip | |
[client] Allow deletion of expired image versions
The menu entry was grayed out for expired versions, making it impossible
to delete such versions.
Diffstat (limited to 'dozentenmodul/src')
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java | 5 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java | 13 |
2 files changed, 12 insertions, 6 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 0b602984..32adaf24 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 @@ -251,7 +251,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe pop.addMenuItem(mnuDownload); pop.addSeparator(); pop.addMenuItem(mnuDelete); - if (Session.isSuperUser()) { + if (Session.canExtendImageExpiry()) { pop.addSeparator(); pop.addMenuItem(mnuExtendExpiryDate); } @@ -307,8 +307,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe && ImagePerms.canLink(image)); mnuDownload.setEnabled(!multiSelection && tblVersions.getSelectedItem().isValid && ImagePerms.canDownload(image)); - mnuDelete.setEnabled(tblVersions.getSelectedItem().isValid - && ImagePerms.canEdit(image)); + mnuDelete.setEnabled(ImagePerms.canEdit(image)); mnuExtendExpiryDate.setEnabled(multiSelection || tblVersions.getSelectedItem().isValid); pop.show(e.getComponent(), e.getX(), e.getY()); 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 a2677638..6eb91fe7 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java @@ -24,7 +24,8 @@ public class Session { private static SatelliteConfig satConf = null; - public static void initialize(WhoamiInfo whoami, String satAddress, String satToken, String masToken, long satApiVersion) { + public static void initialize(WhoamiInfo whoami, String satAddress, String satToken, String masToken, + long satApiVersion) { if (whoami == null || whoami.user == null || whoami.user.userId == null) { throw new IllegalArgumentException( "Cannot initialize session: whoami-Information from satellite incomplete"); @@ -134,14 +135,16 @@ public class Session { } /** - * @return true if the satellite's API version supports publications of images (version 3 and above), false otherwise + * @return true if the satellite's API version supports publications of + * images (version 3 and above), false otherwise */ public static boolean isImagePublishSupported() { return satelliteApiVersion >= 3; } /** - * @return true if the satellite's API version supports netrules, internet blocking, exam mode (version 4 and above), false otherwise + * @return true if the satellite's API version supports netrules, internet + * blocking, exam mode (version 4 and above), false otherwise */ public static boolean isNetrulesSupported() { return satelliteApiVersion >= 4; @@ -172,4 +175,8 @@ public class Session { } } + public static boolean canExtendImageExpiry() { + return isSuperUser() && satelliteApiVersion >= 3; + } + } |
