private void findPrincipals(
     final Map<PrincipalKey, Principal> principals, final AccessControlList acl) {
   for (AccessControlEntry entry : acl) {
     final PrincipalKey key = entry.getPrincipal();
     if (!principals.containsKey(key)) {
       final Optional<? extends Principal> principalValue = securityService.getPrincipal(key);
       if (!principalValue.isPresent()) {
         LOG.warn("Principal could not be resolved: " + key.toString());
       } else {
         principals.put(key, principalValue.get());
       }
     }
   }
 }
Beispiel #2
0
  protected Node createNode(final NodePath parentPath, final String name) {
    final PropertyTree data = new PropertyTree();
    data.setString("displayName", "This is brand new node");
    final PropertySet someData = data.addSet("someData");
    someData.setString("cars", "skoda");
    someData.addString("cars", "tesla model x");
    someData.setString("likes", "plywood");
    someData.setLong("numberOfUselessGadgets", 123L);

    final PatternIndexConfigDocument indexConfig =
        PatternIndexConfigDocument.create()
            .defaultConfig(IndexConfig.MINIMAL)
            .add("displayName", IndexConfig.FULLTEXT)
            .build();

    return Node.create()
        .id(NodeId.from("nodeId"))
        .parentPath(parentPath)
        .name(name)
        .data(data)
        .indexConfigDocument(indexConfig)
        .permissions(
            AccessControlList.create()
                .add(
                    AccessControlEntry.create()
                        .principal(PrincipalKey.ofRole("admin"))
                        .allowAll()
                        .build())
                .build())
        .nodeState(NodeState.DEFAULT)
        .nodeVersionId(NodeVersionId.from("versionKey"))
        .timestamp(Instant.parse("2010-10-10T10:10:10.10Z"))
        .build();
  }