Package gabriel

Examples of gabriel.Permission


    String source = "-PP1 { PM1 }";

    Acl acl = manager.parse(owner, name, new StringReader(source));

    assertEquals("PP1 is denied PM1",
        -1, acl.checkPermission(new Principal("PP1"), new Permission("PM1")));

  }
View Full Code Here


        "                  M3 }" +
        "            PM2 { M1 }";

    Map methodMap = store.parse(new StringReader(source));

    assertTrue("PM1 contains M1", ((Set) methodMap.get("M1")).contains(new Permission("PM1")));
    assertTrue("PM1 contains M2", ((Set) methodMap.get("M2")).contains(new Permission("PM1")));
    assertTrue("PM1 contains M3", ((Set) methodMap.get("M3")).contains(new Permission("PM1")));
    assertTrue("PM2 contains M1", ((Set) methodMap.get("M1")).contains(new Permission("PM2")));
  }
View Full Code Here

  public void testHandleEmptyMethodBlocks() {
    FileMethodStore store = new FileMethodStore();
    String source = "PM1 { } PM2 { M2 }";

    Map methodMap = store.parse(new StringReader(source));
    assertTrue("PM2 contains M2", ((Set) methodMap.get("M2")).contains(new Permission("PM2")));
}
View Full Code Here

    contextAccessManager = new ContextAccessManagerImpl((AccessManager) accessManager.proxy());
  }


  public void testCallsModifyOnContext() {
    Permission permission = new Permission("TestPermission");
    Principal principal = new Principal("TestPrincipal");
    Set principals = new HashSet();
    principals.add(principal);

    mockContext.expects(once()).method("modifyPrincipal").with(same(principals));
View Full Code Here

  protected void setUp() throws Exception {
    super.setUp();
    principal = new Principal("TestPrincipal");
    entry = new AclEntry(principal);
    permission = new Permission("TestPermission");
  }
View Full Code Here

    } catch (SecurityException e) {
    }
  }

  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

    Permission checkPermission = new Permission("TestPermission");
    assertEquals("Principal has permission from entry", 1, acl.checkPermission(checkPrincipal, checkPermission));
  }

  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

TOP

Related Classes of gabriel.Permission

Copyright © 2018 www.massapicom. 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.