Changeset 14:629e15b345aa in AnnotationManagerN4J for src/main/java/de/mpiwg/itgroup/annotations/Annotation.java
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/de/mpiwg/itgroup/annotations/Annotation.java
r10 r14 81 81 protected Actor readPermission; 82 82 83 84 /** 85 * Returns if the requested action is allowed on this annotation. 86 * 87 * @param action 88 * @param userId 89 * @return 90 */ 91 public boolean isActionAllowed(String action, String userId) { 92 if (action.equals("read")) { 93 Actor reader = getReadPermission(); 94 if (reader == null) { 95 return true; 96 } else { 97 return reader.isEquivalentWith(userId); 98 } 99 } else if (action.equals("update")) { 100 // require at least an authenticated user 101 if (userId == null) return false; 102 Actor updater = getUpdatePermission(); 103 if (updater == null) { 104 return true; 105 } else { 106 return updater.isEquivalentWith(userId); 107 } 108 } else if (action.equals("delete")) { 109 // require at least an authenticated user 110 if (userId == null) return false; 111 Actor updater = getUpdatePermission(); 112 if (updater == null) { 113 return true; 114 } else { 115 return updater.isEquivalentWith(userId); 116 } 117 } else if (action.equals("admin")) { 118 // require at least an authenticated user 119 if (userId == null) return false; 120 Actor admin = getAdminPermission(); 121 if (admin == null) { 122 return true; 123 } else { 124 return admin.isEquivalentWith(userId); 125 } 126 } 127 return false; 128 } 129 83 130 /** 84 131 * @return the uri
Note: See TracChangeset
for help on using the changeset viewer.