- Timestamp:
- 01/31/20 13:49:48 (4 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/auth/Actions.java
r1504 r1506 71 71 MessageBay.displayMessage("Test message sent."); 72 72 } 73 74 public static void CheckMailTest() {75 List<Mail.MailEntry> mail = MailBay.getMailClient().checkMail();76 for (Mail.MailEntry entry: mail) {77 MessageBay.displayMessage(entry.toString());78 }79 MessageBay.displayMessage(mail.size() + " new mail since last run.");80 }81 73 82 74 public static void SendTestOneOffMessage(String recipient) { -
trunk/src/org/expeditee/encryption/io/EncryptedExpWriter.java
r1431 r1506 52 52 public EncryptedExpWriter(String encryptionLabel) { 53 53 label = encryptionLabel; 54 if (label.equals( labelNone)) {54 if (label.equals(getLabelNone())) { 55 55 return; 56 56 } … … 122 122 123 123 String toWrite; 124 if (key == null && label.equals( labelNone)) {124 if (key == null && label.equals(getLabelNone())) { 125 125 toWrite = line + nl; 126 126 } else { … … 276 276 } 277 277 } 278 279 /** 280 * @return the labelnone 281 */ 282 public static String getLabelNone() { 283 return labelNone; 284 } 278 285 } -
trunk/src/org/expeditee/gui/AttributeUtils.java
r1505 r1506 204 204 205 205 // Encryption Frame attributes 206 _FrameAttrib.put("FrameEncryptionLabel", Frame.class.getMethod("getFrameEncryptionLabel"), 207 Frame.class.getMethod("setFrameEncryptionLabel", pString)); 208 _FrameAttrib.put("EncryptionFramePermission", Frame.class.getMethod("getFrameEncryptionPermission"), 209 Frame.class.getMethod("setFrameEncryptionPermission", pEncPermission)); 210 _FrameAttrib.put("HomogeneousEncryptionLabel", Frame.class.getMethod("getHomogeneousEncryptionLabel"), 211 Frame.class.getMethod("setHomogeneousEncryptionLabel", pString)); 212 _FrameAttrib.put("EncryptionPermission", Frame.class.getMethod("getEncryptionPermission"), 213 Frame.class.getMethod("setEncryptionPermission", pEncPermission)); 206 _FrameAttrib.put("FrameEncryptionLabel", Frame.class.getMethod("getFrameEncryptionLabel"), 207 Frame.class.getMethod("setFrameEncryptionLabel", pString)); 208 _FrameAttrib.put("EncryptionFramePermission", Frame.class.getMethod("getFrameEncryptionPermission"), 209 Frame.class.getMethod("setFrameEncryptionPermission", pEncPermission)); 210 _FrameAttrib.put("HomogeneousEncryptionLabel", Frame.class.getMethod("getHomogeneousEncryptionLabel"), 211 Frame.class.getMethod("setHomogeneousEncryptionLabel", pString)); 212 _FrameAttrib.put("EncryptionPermission", Frame.class.getMethod("getEncryptionPermission"), 213 Frame.class.getMethod("setEncryptionPermission", pEncPermission)); 214 _FrameAttrib.put("HetrogeneousEncryptionLabels", Frame.class.getMethod("getHetrogeneousFrameOwnerLabels"), 215 Frame.class.getMethod("addToHetrogeneousFrameOwnerLabels", pString)); 214 216 215 217 // aliases for Standard frame attribute settings … … 220 222 // aliases for Encryption frame attribute settings 221 223 _FrameAttrib.alias("encframelabel", "FrameEncryptionLabel"); 224 _FrameAttrib.alias("EncryptionFrameLabel", "FrameEncryptionLabel"); 222 225 _FrameAttrib.alias("encframeperm", "EncryptionFramePermission"); 223 226 _FrameAttrib.alias("homoenclabel", "HomogeneousEncryptionLabel"); -
trunk/src/org/expeditee/gui/Frame.java
r1505 r1506 47 47 import org.expeditee.core.Image; 48 48 import org.expeditee.core.bounds.PolygonBounds; 49 import org.expeditee.encryption.io.EncryptedExpWriter; 49 50 import org.expeditee.encryption.items.EncryptionPermissionTriple; 51 import org.expeditee.encryption.items.UserAppliedEncryptionPermission; 50 52 import org.expeditee.encryption.items.surrogates.Label; 51 53 import org.expeditee.encryption.items.surrogates.Label.LabelInfo; … … 195 197 196 198 private String _encryptionLabel; 197 198 199 private String _homogeneousEncryptionLabel; 200 private List<String> _hetrogeneousEncryptionLabels = new ArrayList<String>(); 199 201 200 202 private String _groupFrameName; … … 3007 3009 3008 3010 public void setFrameEncryptionLabel(String label) { 3011 if (label == null) { 3012 _encryptionLabel = null; 3013 return; 3014 } 3015 3016 String errorMessage = "You do not have sufficient permissions to set the encryption label to " + label + " on frame " + getName(); 3017 UserAppliedEncryptionPermission p = getFrameEncryptionPermission().getPermission(this.getOwner(), this.getGroupMembers()); 3018 String homogeneousEncryptionLabel = getHomogeneousEncryptionLabel(); 3019 if (homogeneousEncryptionLabel == null) { homogeneousEncryptionLabel = getFrameEncryptionLabel(); } 3020 if (homogeneousEncryptionLabel == null) { homogeneousEncryptionLabel = EncryptedExpWriter.getLabelNone(); } 3021 3022 List<String> hetrogeneousFrameOwnerLabels = getHetrogeneousFrameOwnerLabels(); 3023 3024 switch (p) { 3025 case none: 3026 MessageBay.displayMessage(errorMessage); 3027 return; 3028 case homogeneous: 3029 if (!homogeneousEncryptionLabel.equals(label)) { 3030 MessageBay.displayMessage(errorMessage); 3031 return; 3032 } 3033 break; 3034 case hetrogeneous_owner: 3035 if (!homogeneousEncryptionLabel.equals(label) && !hetrogeneousFrameOwnerLabels.contains(label)) { 3036 MessageBay.displayMessage(errorMessage); 3037 return; 3038 } 3039 break; 3040 case hetrogeneous: break; 3041 } 3042 3009 3043 LabelInfo labelResult = Label.getLabel(label); 3010 3044 boolean isProfileOrNone = label.equals("Profile") || label.equals("None"); … … 3018 3052 _encryptionLabel = label; 3019 3053 } 3054 3055 public boolean hasEncryptionPermissionOrHigher(UserAppliedEncryptionPermission permissionLevel) { 3056 UserAppliedEncryptionPermission p = getFrameEncryptionPermission().getPermission(this.getOwner(), this.getGroupMembers()); 3057 return p.ordinal() >= permissionLevel.ordinal(); 3058 } 3020 3059 3021 3060 public EncryptionPermissionTriple getFrameEncryptionPermission() { 3061 if (_frameEncryptionPermission == null) { 3062 _frameEncryptionPermission = EncryptionPermissionTriple.convertString("300"); 3063 } 3022 3064 return _frameEncryptionPermission; 3023 3065 } … … 3029 3071 public String getHomogeneousEncryptionLabel() { 3030 3072 return _homogeneousEncryptionLabel; 3073 } 3074 3075 public List<String> getHetrogeneousFrameOwnerLabels() { 3076 if (_hetrogeneousEncryptionLabels == null) { 3077 _hetrogeneousEncryptionLabels = new ArrayList<String>(); 3078 } 3079 return _hetrogeneousEncryptionLabels; 3080 } 3081 3082 public void addToHetrogeneousFrameOwnerLabels(String label) { 3083 if (!UserSettings.UserName.get().equals(this.getOwner())) { 3084 MessageBay.displayMessage("Only the owner of a frame is able to add hetrogeneous owner encryption labels."); 3085 return; 3086 } 3087 3088 if (_hetrogeneousEncryptionLabels == null) { 3089 _hetrogeneousEncryptionLabels = new ArrayList<String>(); 3090 } 3091 if (_hetrogeneousEncryptionLabels.contains(label)) { 3092 _hetrogeneousEncryptionLabels.remove(label); 3093 } else { 3094 _hetrogeneousEncryptionLabels.add(label); 3095 } 3031 3096 } 3032 3097 … … 3036 3101 if (!isProfileOrNone && !labelResult.is(LabelResult.SuccessResolveLabelToKey)) { 3037 3102 MessageBay.displayMessage(labelResult.toString()); 3038 this._homogeneousEncryptionLabel = null; 3039 return; 3103 MessageBay.displayMessage("You will not be able to set the FrameEncryptionLabel to the Homogeneous Label."); 3040 3104 } 3041 3105 -
trunk/src/org/expeditee/io/Conversion.java
r1505 r1506 650 650 } 651 651 652 if ((method.getReturnType().isEnum()) || (name.equals("getPermission")) || (name.equals("get EncryptionPermission"))) {652 if ((method.getReturnType().isEnum()) || (name.equals("getPermission")) || (name.equals("getFrameEncryptionPermission"))) { 653 653 try { 654 654 return output.getClass().getMethod("getCode", new Class[] {}) -
trunk/src/org/expeditee/io/DefaultFrameReader.java
r1505 r1506 104 104 _FrameTags.put('k', Frame.class.getMethod("setHomogeneousEncryptionLabel", pString)); 105 105 _FrameTags.put('e', Frame.class.getMethod("setEncryptionPermission", pEncPermission)); 106 _FrameTags.put('a', Frame.class.getMethod("addToHetrogeneousFrameOwnerLabels", pString)); 106 107 107 108 // Note: As of 26/11/18 there are no unused letter item tags. Use other characters. -
trunk/src/org/expeditee/io/DefaultFrameWriter.java
r1505 r1506 198 198 _FrameTags.put('k', Frame.class.getMethod("getHomogeneousEncryptionLabel")); 199 199 _FrameTags.put('e', Frame.class.getMethod("getEncryptionPermission")); 200 _FrameTags.put('a', Frame.class.getMethod("getHetrogeneousFrameOwnerLabels")); 200 201 201 202 // Note: As of 26/11/18 there are no unused letter item tags. Use other characters.
Note:
See TracChangeset
for help on using the changeset viewer.