Changeset 15:58357a4b86de 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
r14 r15 3 3 */ 4 4 package de.mpiwg.itgroup.annotations; 5 6 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore; 5 7 6 8 /** … … 86 88 * 87 89 * @param action 88 * @param userId 90 * @param user 91 * @param store AnnotationStore to check group membership 89 92 * @return 90 93 */ 91 public boolean isActionAllowed(String action, String userId) {94 public boolean isActionAllowed(String action, Person user, AnnotationStore store) { 92 95 if (action.equals("read")) { 93 96 Actor reader = getReadPermission(); … … 95 98 return true; 96 99 } else { 97 return reader.isEquivalentWith(user Id);100 return reader.isEquivalentWith(user, store); 98 101 } 99 102 } else if (action.equals("update")) { 100 103 // require at least an authenticated user 101 if (user Id== null) return false;104 if (user == null) return false; 102 105 Actor updater = getUpdatePermission(); 103 106 if (updater == null) { 104 107 return true; 105 108 } else { 106 return updater.isEquivalentWith(user Id);109 return updater.isEquivalentWith(user, store); 107 110 } 108 111 } else if (action.equals("delete")) { 109 112 // require at least an authenticated user 110 if (user Id== null) return false;113 if (user == null) return false; 111 114 Actor updater = getUpdatePermission(); 112 115 if (updater == null) { 113 116 return true; 114 117 } else { 115 return updater.isEquivalentWith(user Id);118 return updater.isEquivalentWith(user, store); 116 119 } 117 120 } else if (action.equals("admin")) { 118 121 // require at least an authenticated user 119 if (user Id== null) return false;122 if (user == null) return false; 120 123 Actor admin = getAdminPermission(); 121 124 if (admin == null) { 122 125 return true; 123 126 } else { 124 return admin.isEquivalentWith(user Id);127 return admin.isEquivalentWith(user, store); 125 128 } 126 129 }
Note: See TracChangeset
for help on using the changeset viewer.