Ignore:
Timestamp:
Aug 28, 2012, 6:23:12 PM (12 years ago)
Author:
casties
Branch:
default
Message:

ASSIGNED - # 249: Annotations shared in groups
https://it-dev.mpiwg-berlin.mpg.de/tracs/mpdl-project-software/ticket/249

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/de/mpiwg/itgroup/annotations/Annotation.java

    r14 r15  
    33 */
    44package de.mpiwg.itgroup.annotations;
     5
     6import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
    57
    68/**
     
    8688     *
    8789     * @param action
    88      * @param userId
     90     * @param user
     91     * @param store AnnotationStore to check group membership
    8992     * @return
    9093     */
    91     public boolean isActionAllowed(String action, String userId) {
     94    public boolean isActionAllowed(String action, Person user, AnnotationStore store) {
    9295        if (action.equals("read")) {
    9396            Actor reader = getReadPermission();
     
    9598                return true;
    9699            } else {
    97                 return reader.isEquivalentWith(userId);
     100                return reader.isEquivalentWith(user, store);
    98101            }
    99102        } else if (action.equals("update")) {
    100103            // require at least an authenticated user
    101             if (userId == null) return false;
     104            if (user == null) return false;
    102105            Actor updater = getUpdatePermission();
    103106            if (updater == null) {
    104107                return true;
    105108            } else {
    106                 return updater.isEquivalentWith(userId);
     109                return updater.isEquivalentWith(user, store);
    107110            }
    108111        } else if (action.equals("delete")) {
    109112            // require at least an authenticated user
    110             if (userId == null) return false;
     113            if (user == null) return false;
    111114            Actor updater = getUpdatePermission();
    112115            if (updater == null) {
    113116                return true;
    114117            } else {
    115                 return updater.isEquivalentWith(userId);
     118                return updater.isEquivalentWith(user, store);
    116119            }
    117120        } else if (action.equals("admin")) {
    118121            // require at least an authenticated user
    119             if (userId == null) return false;
     122            if (user == null) return false;
    120123            Actor admin = getAdminPermission();
    121124            if (admin == null) {
    122125                return true;
    123126            } else {
    124                 return admin.isEquivalentWith(userId);
     127                return admin.isEquivalentWith(user, store);
    125128            }
    126129        }
Note: See TracChangeset for help on using the changeset viewer.