Changeset 105:7417f5915181 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
r95 r105 132 132 133 133 /** 134 * Enum of actions (for permissions). 135 */ 136 public static enum Action { 137 read, update, create, delete, admin 138 } 139 140 /** 134 141 * Returns if the requested action is allowed for the given user on this annotation. 135 142 * … … 139 146 * @return 140 147 */ 141 public boolean isActionAllowed( Stringaction, Person user, AnnotationStore store) {142 if (action .equals("read")) {148 public boolean isActionAllowed(Action action, Person user, AnnotationStore store) { 149 if (action == Action.read) { 143 150 Actor reader = getReadPermission(); 144 151 if (reader == null) { … … 148 155 return reader.isEquivalentWith(user, store); 149 156 } 150 } else if (action .equals("update")) {157 } else if (action == Action.update) { 151 158 // require at least an authenticated user 152 159 if (user == null) return false; … … 158 165 return updater.isEquivalentWith(user, store); 159 166 } 160 } else if (action .equals("delete")) {167 } else if (action == Action.delete) { 161 168 // require at least an authenticated user 162 169 if (user == null) return false; … … 167 174 } 168 175 return deleter.isEquivalentWith(user, store); 169 } else if (action .equals("admin")) {176 } else if (action == Action.admin) { 170 177 // require at least an authenticated user 171 178 if (user == null) return false;
Note: See TracChangeset
for help on using the changeset viewer.