Package gabriel.components.io

Examples of gabriel.components.io.FileAclStore


  public static void main(String[] args) {

    // First we setup some components which manage access
    // checking for us. We use versions that use files
    // to store mappings
    AclStore aclStore = new FileAclStore();
    MethodStore methodStore = new FileMethodStore();

    AccessManager manager = new AccessManagerImpl(aclStore);
    MethodAccessManager methodAccessManager = new MethodAccessManagerImpl(manager, methodStore);
View Full Code Here


    owner = new Principal("Owner");
    name = "TestName";
  }

  public void testParse() {
    FileAclStore manager = new FileAclStore();
    String source = "PP1 { PM1 PM2 \n" +
        "                  PM3 }" +
        "            PP2 { PM1 }";

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

    assertEquals("PP1 has PM1",
        1, acl.checkPermission(new Principal("PP1"), new Permission("PM1")));
    assertEquals("PP1 has PM2",
        1, acl.checkPermission(new Principal("PP1"), new Permission("PM2")));
View Full Code Here

    assertEquals("PP2 has PM1",
        1, acl.checkPermission(new Principal("PP2"), new Permission("PM1")));
  }

  public void testNegativePermissions() {
    FileAclStore manager = new FileAclStore();
    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

TOP

Related Classes of gabriel.components.io.FileAclStore

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.