@Test public void testAutoCreatedItemsUponSystemUserCreation() throws Exception { UserProvider up = createUserProvider(); assertAutoCreatedItems(up.createSystemUser("s", null), UserConstants.NT_REP_SYSTEM_USER, root); }
@NotNull Tree createSystemUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { String relSysPath = config.getConfigValue(PARAM_SYSTEM_RELATIVE_PATH, DEFAULT_SYSTEM_RELATIVE_PATH); String relPath; if (intermediateJcrPath == null) { relPath = relSysPath; } else { if (!(intermediateJcrPath.startsWith(relSysPath) || intermediateJcrPath.startsWith(userPath + '/' + relSysPath))) { throw new ConstraintViolationException("System users must be located in the 'system' subtree of the user root."); } relPath = intermediateJcrPath; } return createAuthorizableNode(userID, NT_REP_SYSTEM_USER, relPath); }
UserProvider extends AuthorizableBaseProvider { @NotNull Tree createSystemUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { String relSysPath = config.getConfigValue(PARAM_SYSTEM_RELATIVE_PATH, DEFAULT_SYSTEM_RELATIVE_PATH); String relPath; if (intermediateJcrPath == null) { relPath = relSysPath; } else { if (!(intermediateJcrPath.startsWith(relSysPath) || intermediateJcrPath.startsWith(userPath + '/' + relSysPath))) { throw new ConstraintViolationException("System users must be located in the 'system' subtree of the user root."); } relPath = intermediateJcrPath; } return createAuthorizableNode(userID, NT_REP_SYSTEM_USER, relPath); } }
UserProvider extends AuthorizableBaseProvider { @NotNull Tree createSystemUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { String relSysPath = config.getConfigValue(PARAM_SYSTEM_RELATIVE_PATH, DEFAULT_SYSTEM_RELATIVE_PATH); String relPath; if (intermediateJcrPath == null) { relPath = relSysPath; } else { if (!(intermediateJcrPath.startsWith(relSysPath) || intermediateJcrPath.startsWith(userPath + '/' + relSysPath))) { throw new ConstraintViolationException("System users must be located in the 'system' subtree of the user root."); } relPath = intermediateJcrPath; } return createAuthorizableNode(userID, NT_REP_SYSTEM_USER, relPath); } UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config); }
UserProvider extends AuthorizableBaseProvider { @NotNull Tree createSystemUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { String relSysPath = config.getConfigValue(PARAM_SYSTEM_RELATIVE_PATH, DEFAULT_SYSTEM_RELATIVE_PATH); String relPath; if (intermediateJcrPath == null) { relPath = relSysPath; } else { if (!(intermediateJcrPath.startsWith(relSysPath) || intermediateJcrPath.startsWith(userPath + '/' + relSysPath))) { throw new ConstraintViolationException("System users must be located in the 'system' subtree of the user root."); } relPath = intermediateJcrPath; } return createAuthorizableNode(userID, NT_REP_SYSTEM_USER, relPath); } UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config);  }
UserProvider extends AuthorizableBaseProvider { @NotNull Tree createSystemUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { String relSysPath = config.getConfigValue(PARAM_SYSTEM_RELATIVE_PATH, DEFAULT_SYSTEM_RELATIVE_PATH); String relPath; if (intermediateJcrPath == null) { relPath = relSysPath; } else { if (!(intermediateJcrPath.startsWith(relSysPath) || intermediateJcrPath.startsWith(userPath + '/' + relSysPath))) { throw new ConstraintViolationException("System users must be located in the 'system' subtree of the user root."); } relPath = intermediateJcrPath; } return createAuthorizableNode(userID, NT_REP_SYSTEM_USER, relPath); } UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config);   }