Changeset 1394
- Timestamp:
- 05/30/19 12:40:31 (5 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/encryption/items/EncryptionPermissionTriple.java
r1390 r1394 12 12 private UserAppliedEncryptionPermission otherPermission; 13 13 14 public EncryptionPermissionTriple(String permissionCode, 15 UserAppliedEncryptionPermission defaultPermission) { 16 ownerPermission = defaultPermission; 17 groupPermission = defaultPermission; 18 otherPermission = defaultPermission; 14 public EncryptionPermissionTriple(String permissionCode, String defaultPermission) { 15 ownerPermission = defaultPermission.length() > 0 ? 16 UserAppliedEncryptionPermission.getPermission(defaultPermission.charAt(0) + "", UserAppliedEncryptionPermission.none) : 17 UserAppliedEncryptionPermission.none; 18 groupPermission = defaultPermission.length() > 1 ? 19 UserAppliedEncryptionPermission.getPermission(defaultPermission.charAt(1) + "", UserAppliedEncryptionPermission.none) : 20 UserAppliedEncryptionPermission.none;; 21 otherPermission = defaultPermission.length() > 2 ? 22 UserAppliedEncryptionPermission.getPermission(defaultPermission.charAt(2) + "", UserAppliedEncryptionPermission.none) : 23 UserAppliedEncryptionPermission.none;; 19 24 20 25 if (permissionCode != null) { … … 24 29 // If it does not then it will remain as the default permission passed to the function. 25 30 String ownerPermissionCode = permissionCode.charAt(0) + ""; 26 this.ownerPermission = UserAppliedEncryptionPermission.getPermission(ownerPermissionCode, defaultPermission);31 this.ownerPermission = UserAppliedEncryptionPermission.getPermission(ownerPermissionCode, ownerPermission); 27 32 28 33 // If the permission code has a character at index 1, then it is the group permission. … … 30 35 if (permissionCode.length() < 2) { return; } 31 36 String groupPermissionCode = permissionCode.charAt(1) + ""; 32 this.groupPermission = UserAppliedEncryptionPermission.getPermission(groupPermissionCode, defaultPermission);37 this.groupPermission = UserAppliedEncryptionPermission.getPermission(groupPermissionCode, groupPermission); 33 38 34 39 if (permissionCode.length() < 3) { return; } 35 40 String otherPermissionCode = permissionCode.charAt(2) + ""; 36 this.otherPermission = UserAppliedEncryptionPermission.getPermission(otherPermissionCode, defaultPermission);41 this.otherPermission = UserAppliedEncryptionPermission.getPermission(otherPermissionCode, otherPermission); 37 42 } 38 43 } … … 65 70 66 71 public static EncryptionPermissionTriple convertString(String permissionCode) { 67 UserAppliedEncryptionPermission defaultPermission = UserAppliedEncryptionPermission.values()[EncryptionDefaults.DefaultEncryptionPermission.get()];68 return new EncryptionPermissionTriple(permissionCode, default Permission);72 String defaultEncryptionPermission = EncryptionDefaults.DefaultEncryptionPermission.get(); 73 return new EncryptionPermissionTriple(permissionCode, defaultEncryptionPermission); 69 74 } 70 75 -
trunk/src/org/expeditee/settings/encryption/EncryptionDefaults.java
r1390 r1394 1 1 package org.expeditee.settings.encryption; 2 2 3 import org.expeditee.setting. IntegerSetting;3 import org.expeditee.setting.StringSetting; 4 4 5 5 public class EncryptionDefaults { 6 public static final IntegerSetting DefaultEncryptionPermission = new IntegerSetting( 7 "The default level of permission for encryption when not otherwise specified", 8 "DefaultEncryptionPermission", 9 0 6 public static final StringSetting DefaultEncryptionPermission = new StringSetting( 7 "The default level of permission for encryption when not otherwise specified", 8 "000" 10 9 ); 11 10 }
Note:
See TracChangeset
for help on using the changeset viewer.