Mercurial > hg > AnnotationManagerN4J
diff src/main/java/de/mpiwg/itgroup/annotations/Annotation.java @ 15:58357a4b86de
ASSIGNED - # 249: Annotations shared in groups
https://it-dev.mpiwg-berlin.mpg.de/tracs/mpdl-project-software/ticket/249
author | casties |
---|---|
date | Tue, 28 Aug 2012 20:23:12 +0200 |
parents | 629e15b345aa |
children | 794077e6288c |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/Annotation.java Fri Jul 13 20:41:02 2012 +0200 +++ b/src/main/java/de/mpiwg/itgroup/annotations/Annotation.java Tue Aug 28 20:23:12 2012 +0200 @@ -3,6 +3,8 @@ */ package de.mpiwg.itgroup.annotations; +import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore; + /** * @author casties * @@ -85,43 +87,44 @@ * Returns if the requested action is allowed on this annotation. * * @param action - * @param userId + * @param user + * @param store AnnotationStore to check group membership * @return */ - public boolean isActionAllowed(String action, String userId) { + public boolean isActionAllowed(String action, Person user, AnnotationStore store) { if (action.equals("read")) { Actor reader = getReadPermission(); if (reader == null) { return true; } else { - return reader.isEquivalentWith(userId); + return reader.isEquivalentWith(user, store); } } else if (action.equals("update")) { // require at least an authenticated user - if (userId == null) return false; + if (user == null) return false; Actor updater = getUpdatePermission(); if (updater == null) { return true; } else { - return updater.isEquivalentWith(userId); + return updater.isEquivalentWith(user, store); } } else if (action.equals("delete")) { // require at least an authenticated user - if (userId == null) return false; + if (user == null) return false; Actor updater = getUpdatePermission(); if (updater == null) { return true; } else { - return updater.isEquivalentWith(userId); + return updater.isEquivalentWith(user, store); } } else if (action.equals("admin")) { // require at least an authenticated user - if (userId == null) return false; + if (user == null) return false; Actor admin = getAdminPermission(); if (admin == null) { return true; } else { - return admin.isEquivalentWith(userId); + return admin.isEquivalentWith(user, store); } } return false;