use of com.enonic.xp.node.NodePath in project xp by enonic.
the class SecurityInitializer method initializeRoleFolder.
private void initializeRoleFolder() {
final NodePath rolesNodePath = IdProviderNodeTranslator.getRolesNodePath();
LOG.info("Initializing [" + rolesNodePath + "] folder");
nodeService.create(CreateNodeParams.create().parent(rolesNodePath.getParentPath()).name(rolesNodePath.getLastElement().toString()).inheritPermissions(true).build());
}
use of com.enonic.xp.node.NodePath in project xp by enonic.
the class SecurityInitializer method initializeIdProviderParentFolder.
private void initializeIdProviderParentFolder() {
final NodePath idProviderParentNodePath = IdProviderNodeTranslator.getIdProvidersParentPath();
LOG.info("Initializing [" + idProviderParentNodePath.toString() + "] folder");
final AccessControlEntry userManagerFullAccess = AccessControlEntry.create().allowAll().principal(RoleKeys.USER_MANAGER_ADMIN).build();
final ChildOrder childOrder = ChildOrder.create().add(FieldOrderExpr.create(NodeIndexPath.NAME, OrderExpr.Direction.ASC)).build();
nodeService.create(CreateNodeParams.create().parent(idProviderParentNodePath.getParentPath()).name(idProviderParentNodePath.getLastElement().toString()).permissions(AccessControlList.create().addAll(SystemConstants.SYSTEM_REPO_DEFAULT_ACL.getEntries()).add(userManagerFullAccess).build()).inheritPermissions(false).childOrder(childOrder).build());
}
use of com.enonic.xp.node.NodePath in project xp by enonic.
the class SecurityServiceImpl method deleteIdProvider.
@Override
public void deleteIdProvider(final IdProviderKey idProviderKey) {
removeRelationships(idProviderKey);
final NodeIds deletedNodes = callWithContext(() -> {
final NodePath idProviderNodePath = IdProviderNodeTranslator.toIdProviderNodePath(idProviderKey);
final Node node = this.nodeService.getByPath(idProviderNodePath);
if (node == null) {
return null;
}
return this.nodeService.deleteById(node.id());
});
if (deletedNodes == null) {
throw new IdProviderNotFoundException(idProviderKey);
}
}
use of com.enonic.xp.node.NodePath in project xp by enonic.
the class PrincipalKeyTest method testToPath.
@Test
public void testToPath() throws Exception {
final PrincipalKey anonymous = PrincipalKey.from("user:system:anonymous");
final PrincipalKey user = PrincipalKey.from("user:myIdProvider:myUser");
final PrincipalKey group = PrincipalKey.from("group:myIdProvider:mygroup");
final PrincipalKey role = PrincipalKey.from("role:myrole");
assertEquals(new NodePath("/identity/system/users/anonymous"), anonymous.toPath());
assertEquals(new NodePath("/identity/roles/myrole"), role.toPath());
assertEquals(new NodePath("/identity/myIdProvider/groups/mygroup"), group.toPath());
assertEquals(new NodePath("/identity/myIdProvider/users/myUser"), user.toPath());
}
use of com.enonic.xp.node.NodePath in project xp by enonic.
the class ApplicationRepoInitializer method initApplicationFolder.
private void initApplicationFolder() {
final NodePath applicationsRootPath = ApplicationRepoServiceImpl.APPLICATION_PATH;
LOG.info("Initializing [" + applicationsRootPath + "] folder");
nodeService.create(CreateNodeParams.create().parent(applicationsRootPath.getParentPath()).name(applicationsRootPath.getLastElement().toString()).inheritPermissions(true).build());
}
Aggregations