Package com.getperka.flatpack.security

Examples of com.getperka.flatpack.security.GroupPermissions


        // Definitively break if a new kind is added
        throw new UnsupportedOperationException(target.getKind().name());
    }

    // See if there's any cached data
    GroupPermissions toReturn = cache.get(target);
    if (toReturn != null) {
      return toReturn;
    }

    // Determine which targets should be inherited from
    List<SecurityTarget> targets = listForAny();
    computeTargets(target, targets);

    // Lazily construct the inner implementation, since it requires injection
    StaticPolicyImpl policy = maybeParse();

    // Pull the data from the policy tree
    toReturn = new GroupPermissions();
    for (SecurityTarget t : targets) {
      policy.extractPermissions(toReturn, t);
    }

    // Cache and return
View Full Code Here


    doTest(contents, ExtendsMerchant.class);
  }

  void doTest(String contents, Class<? extends Merchant> clazz) {
    FlatPack fp = flatpack(contents);
    GroupPermissions p = fp.getTypeContext().describe(clazz).getGroupPermissions();
    assertNotNull(p);

    // Check various type-level permissions
    checkMerchantPermissions(p);

    // Check property-level permissions, especially type- and global-overrides
    Property name = getProperty(fp.getTypeContext(), clazz, "name");
    p = name.getGroupPermissions();
    assertNotNull(p);
    // Just replacing a previous declaration
    assertEquals(5, p.getOperations().size());
    checkPermissions(p, "*", "crudOperation.read");

    // Test the "allow only" construct
    Property note = getProperty(fp.getTypeContext(), clazz, "note");
    p = note.getGroupPermissions();
    assertNotNull(p);
    assertEquals(1, p.getOperations().size());
    checkPermissions(p, "internalUser", "*.*");

    // Verify that unreferenced properties inherit the type's allow
    Property other = getProperty(fp.getTypeContext(), clazz, "other");
    p = other.getGroupPermissions();
View Full Code Here

TOP

Related Classes of com.getperka.flatpack.security.GroupPermissions

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.