Ignore:
Timestamp:
Jul 13, 2012, 6:41:02 PM (12 years ago)
Author:
casties
Branch:
default
Message:

permissions mostly work. need more server-side checking.

File:
1 edited

Legend:

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

    r13 r14  
    88/**
    99 * @author casties
    10  *
     10 * 
    1111 */
    1212public abstract class Actor {
     
    1515    public String name;
    1616    public String id;
    17    
     17
    1818    /**
    1919     * @return if this Actor is a Group
    2020     */
    2121    public abstract boolean isGroup();
    22    
     22
     23    /**
     24     * Returns if this Actor is equivalent to an Actor with this id. If this is
     25     * a Group returns true when the Person is in the Group.
     26     *
     27     * @param userId
     28     * @return
     29     */
     30    public boolean isEquivalentWith(String userId) {
     31        if (userId == null) return false;
     32        if (userId.equals(getIdString())) {
     33            return true;
     34        }
     35        if (isGroup()) {
     36            // TODO: check if person in group
     37        }
     38        return false;
     39    }
     40
    2341    /**
    2442     * @return the uri
     
    3452     */
    3553    public String getUriString() {
    36         if (uri == null) {
    37                 return getUriFromId(id, isGroup());
    38         }
     54        if (uri == null) {
     55            return getUriFromId(id, isGroup());
     56        }
    3957        return uri;
    4058    }
    4159
    4260    /**
    43      * @param uri the uri to set
     61     * @param uri
     62     *            the uri to set
    4463     */
    4564    public void setUri(String uri) {
    4665        this.uri = uri;
    4766    }
     67
    4868    /**
    4969     * @return the name
     
    5272        return name;
    5373    }
     74
    5475    /**
    55      * @param name the name to set
     76     * @param name
     77     *            the name to set
    5678     */
    5779    public void setName(String name) {
     
    6587        return id;
    6688    }
    67    
     89
    6890    /**
    6991     * Returns id as a String starting with "group:" for groups.
     
    7294     */
    7395    public abstract String getIdString();
    74    
     96
    7597    /**
    76      * @param id the id to set
     98     * @param id
     99     *            the id to set
    77100     */
    78101    public void setId(String id) {
    79102        this.id = id;
    80103    }
    81    
     104
    82105    /**
    83106     * Returns a short id from an uri.
     
    110133            prefix = NS.MPIWG_GROUPS_URL;
    111134        }
    112         if (id != null && ! id.startsWith("http://")) {
    113             uri = prefix + id; 
     135        if (id != null && !id.startsWith("http://")) {
     136            uri = prefix + id;
    114137        }
    115138        return uri;
Note: See TracChangeset for help on using the changeset viewer.