| SecurityInfo |

    1   /*
    2    *  SecurityInfo.java
    3    *
    4    *  Copyright (c) 1998-2001, The University of Sheffield.
    5    *
    6    *  This file is part of GATE (see http://gate.ac.uk/), and is free
    7    *  software, licenced under the GNU Library General Public License,
    8    *  Version 2, June 1991 (in the distribution as file licence.html,
    9    *  and also available at http://gate.ac.uk/gate/licence.html).
    10   *
    11   *  Marin Dimitrov, 10/Oct/2001
    12   *
    13   *  $Id: SecurityInfo.java,v 1.2 2001/10/30 12:45:40 valyt Exp $
    14   */
    15
    16  package gate.security;
    17
    18  import junit.framework.*;
    19
    20  public class SecurityInfo {
    21
    22    /** world read/ group write */
    23    public static final int ACCESS_WR_GW = 1;
    24    /** group read/ group write */
    25    public static final int ACCESS_GR_GW = 2;
    26    /** group read/ owner write */
    27    public static final int ACCESS_GR_OW = 3;
    28    /** owner read/ owner write */
    29    public static final int ACCESS_OR_OW = 4;
    30
    31
    32    protected Group grp;
    33    protected User  usr;
    34    protected int   accessMode;
    35
    36    public SecurityInfo(int accessMode,User usr,Group grp) {
    37
    38      //0. preconditions
    39      Assert.assertTrue(accessMode == this.ACCESS_GR_GW ||
    40                    accessMode == this.ACCESS_GR_OW ||
    41                    accessMode == this.ACCESS_OR_OW ||
    42                    accessMode == this.ACCESS_WR_GW);
    43
    44      this.accessMode = accessMode;
    45      this.usr = usr;
    46      this.grp = grp;
    47
    48      //don't register as change listener for froups/users
    49      //because if an attempt to delete group/user is performed
    50      //and they own documents then the attempt will fail
    51    }
    52
    53
    54    public Group getGroup() {
    55      return this.grp;
    56    }
    57
    58
    59    public User getUser() {
    60      return this.usr;
    61    }
    62
    63    public int getAccessMode() {
    64      return this.accessMode;
    65    }
    66  }

| SecurityInfo |