Ignore:
Timestamp:
Feb 10, 2017, 2:45:35 PM (7 years ago)
Author:
casties
Branch:
default
Tags:
tip
Message:

check admin permission before changing permissions.
Enum for typesafe actions.

File:
1 edited

Legend:

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

    r102 r105  
    4242
    4343import de.mpiwg.itgroup.annotations.Annotation;
     44import de.mpiwg.itgroup.annotations.Annotation.Action;
    4445import de.mpiwg.itgroup.annotations.Person;
    4546import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
     
    9596        Annotation annot = store.getAnnotationById(id);
    9697        if (annot != null) {
    97             if (!annot.isActionAllowed("read", authUser, store)) {
     98            if (!annot.isActionAllowed(Action.read, authUser, store)) {
    9899                setStatus(Status.CLIENT_ERROR_FORBIDDEN, "Not Authorized!");
    99100                return null;
     
    116117        for (Annotation annotation : annotations) {
    117118            // check permission
    118             if (!annotation.isActionAllowed("read", authUser, store))
     119            if (!annotation.isActionAllowed(Action.read, authUser, store))
    119120                continue;
    120121            // add annotation to list
     
    238239                return null;
    239240            }
    240             if (!storedAnnot.isActionAllowed("update", authUser, store)) {
     241            if (!storedAnnot.isActionAllowed(Action.update, authUser, store)) {
    241242                setStatus(Status.CLIENT_ERROR_FORBIDDEN);
    242243                return null;
     
    287288        Annotation annot = store.getAnnotationById(id);
    288289        if (annot != null) {
    289             if (!annot.isActionAllowed("delete", authUser, store)) {
     290            if (!annot.isActionAllowed(Action.delete, authUser, store)) {
    290291                setStatus(Status.CLIENT_ERROR_FORBIDDEN, "Not Authorized!");
    291292                return null;
Note: See TracChangeset for help on using the changeset viewer.