Examples of AclEntry


Examples of gabriel.acl.AclEntry

    }
  }

  public void testRemoveAclEntry() {
    Principal principal = new Principal("TestPrincipal");
    AclEntry entry = new AclEntry(principal);
    acl.addEntry(owner, entry);
    assertTrue("AclEntry says true to remove.", acl.removeEntry(owner, entry));
    assertTrue("Acl does not contain removed entry.", !acl.entries().contains(entry));
  }
View Full Code Here

Examples of gabriel.acl.AclEntry

    assertTrue("Acl does not contain removed entry.", !acl.entries().contains(entry));
  }

  public void testRemoveEntryWithWrongOwner() {
    Principal principal = new Principal("TestPrincipal");
    AclEntry entry = new AclEntry(principal);
    acl.addEntry(owner, entry);
    try {
      acl.removeEntry(new Principal("Owner"), entry);
      fail("Should raise an SecurityException");
    } catch (SecurityException e) {
View Full Code Here

Examples of gabriel.acl.AclEntry

  }

  public void testCheckPermission() {
    Permission permission = new Permission("TestPermission");
    Principal principal = new Principal("TestPrincipal");
    AclEntry entry = new AclEntry(principal);
    entry.addPermission(permission);
    acl.addEntry(owner, entry);

    Principal checkPrincipal = new Principal("TestPrincipal");
    Permission checkPermission = new Permission("TestPermission");
    assertEquals("Principal has permission from entry", 1, acl.checkPermission(checkPrincipal, checkPermission));
View Full Code Here

Examples of gabriel.acl.AclEntry

  }

  public void testNegativePermsissionCancelsPermission() {
    Permission permission = new Permission("TestPermission");
    Principal principal = new Principal("TestPrincipal");
    AclEntry entry = new AclEntry(principal);
    entry.addPermission(permission);
    acl.addEntry(owner, entry);

    AclEntry negativeEntry = new AclEntry(principal);
    negativeEntry.addPermission(permission);
    negativeEntry.setNegativePermissions();
    acl.addEntry(owner, negativeEntry);

    Principal checkPrincipal = new Principal("TestPrincipal");
    Permission checkPermission = new Permission("TestPermission");
    assertEquals("Principal does not have permission because of negative entry", -1, acl.checkPermission(checkPrincipal, checkPermission));
View Full Code Here

Examples of java.security.acl.AclEntry

        // PrincipalImpl() take the current host as entry
        owner = new PrincipalImpl();
        try {
            acl = new AclImpl(owner,Owner);
            AclEntry ownEntry = new AclEntryImpl(owner);
            ownEntry.addPermission(READ);
            ownEntry.addPermission(WRITE);
            acl.addEntry(owner,ownEntry);
        } catch (NotOwnerException ex) {
            if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
                SNMP_LOGGER.logp(Level.FINEST, SnmpAcl.class.getName(),
                    "SnmpAcl(String,String)",
View Full Code Here

Examples of java.security.acl.AclEntry

    public void rereadTheFile() throws NotOwnerException, UnknownHostException {
        alwaysAuthorized = false;
        acl.removeAll(owner);
        trapDestList.clear();
        informDestList.clear();
        AclEntry ownEntry = new AclEntryImpl(owner);
        ownEntry.addPermission(READ);
        ownEntry.addPermission(WRITE);
        acl.addEntry(owner,ownEntry);
        readAuthorizedListFile();
    }
View Full Code Here

Examples of java.security.acl.AclEntry

   */
  @Override
  public boolean checkPermission(Principal user,
                                 java.security.acl.Permission perm) {
        for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
          AclEntry ent = e.nextElement();
          if (ent.getPrincipal().equals(user))
                if (ent.checkPermission(perm)) return true;
        }
        return false;
  }
View Full Code Here

Examples of java.security.acl.AclEntry

   * @see java.security.Principal
   */
  public Enumeration getPermissions(Principal user){
  Vector empty = new Vector();
  for (Enumeration e = entryList.elements();e.hasMoreElements();){
    AclEntry ent = (AclEntry) e.nextElement();
    if (ent.getPrincipal().equals(user))
    return ent.permissions();
  }
  return empty.elements();
  }
View Full Code Here

Examples of java.security.acl.AclEntry

   * @see java.security.Permission
   */
  public boolean checkPermission(Principal user,
         java.security.acl.Permission perm) {
  for (Enumeration e = entryList.elements();e.hasMoreElements();){
    AclEntry ent = (AclEntry) e.nextElement();
    if (ent.getPrincipal().equals(user))
    if (ent.checkPermission(perm)) return true;
  }
  return false;
  }
View Full Code Here

Examples of java.security.acl.AclEntry

       
        // PrincipalImpl() take the current host as entry
        owner = new PrincipalImpl();
        try {
            acl = new AclImpl(owner,Owner);
            AclEntry ownEntry = new AclEntryImpl(owner);
            ownEntry.addPermission(READ);
            ownEntry.addPermission(WRITE);
            acl.addEntry(owner,ownEntry);
        } catch (NotOwnerException ex) {
            if (isDebugOn()) {
                debug("constructor",
          "Should never get NotOwnerException as the owner"+
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.