Changeset 37:34b9d044d0bf in AnnotationManagerN4J for src/main/java/de/mpiwg/itgroup/annotations
- Timestamp:
- Sep 26, 2012, 12:48:41 PM (13 years ago)
- Branch:
- default
- Location:
- src/main/java/de/mpiwg/itgroup/annotations/restlet
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java
r34 r37 56 56 logger.debug("annotation-id=" + id); 57 57 58 59 // do authentication 60 Person authUser = Person.createPersonWithId(this.checkAuthToken(entity)); 61 logger.debug("request authenticated=" + authUser); 62 58 63 if (id == null) { 59 64 60 return getAllAnnotations(); 61 } 62 63 // do authentication 64 Person authUser = Person.createPersonWithId(this.checkAuthToken(entity)); 65 logger.debug("request authenticated=" + authUser); 66 65 return getAllAnnotations(authUser); 66 } 67 68 67 69 AnnotationStore store = getAnnotationStore(); 68 70 Annotation annot = store.getAnnotationById(id); … … 83 85 } 84 86 85 private Representation getAllAnnotations( ) {87 private Representation getAllAnnotations(Person authUser) { 86 88 87 89 Form form = getRequest().getResourceRef().getQueryAsForm(); … … 98 100 List<Annotation> annotations = store.getAnnotations(null, null); 99 101 for (Annotation annotation : annotations) { 100 102 //check permission 103 if (!annotation.isActionAllowed("read", authUser, store)) continue; 104 101 105 JSONObject jo = createAnnotatorJson(annotation,false); 102 106 results.add(jo); -
src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotationsByTags.java
r31 r37 18 18 import de.mpiwg.itgroup.annotations.Annotation; 19 19 import de.mpiwg.itgroup.annotations.NS; 20 import de.mpiwg.itgroup.annotations.Person; 20 21 import de.mpiwg.itgroup.annotations.Tag; 21 22 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore; … … 38 39 setCorsHeaders(); 39 40 41 // do authentication 42 Person authUser = Person.createPersonWithId(this.checkAuthToken(entity)); 43 logger.debug("request authenticated=" + authUser); 44 45 40 46 String jsonId = (String) getRequest().getAttributes().get("id"); 41 47 … … 60 66 61 67 for (Annotation annot : annotations) { 62 JSONObject jo = createAnnotatorJson(annot,false); 68 //check permission 69 if (!annot.isActionAllowed("read", authUser, store)) continue; 70 71 JSONObject jo = createAnnotatorJson(annot,false); 63 72 results.add(jo); 64 73 }
Note: See TracChangeset
for help on using the changeset viewer.