}
//----------------------------------------------< RepositoryInitializer >---
@Override
public void initialize(NodeStore store) {
Root root = new RootImpl(store);
UserConfiguration userConfiguration = securityProvider.getUserConfiguration();
UserManager userManager = userConfiguration.getUserManager(root, NamePathMapper.DEFAULT);
try {
NodeUtil rootTree = new NodeUtil(root.getTree("/"));
NodeUtil index = rootTree.getOrAddChild(IndexConstants.INDEX_DEFINITIONS_NAME, JcrConstants.NT_UNSTRUCTURED);
IndexUtils.createIndexDefinition(index, "authorizableId", true, UserConstants.REP_AUTHORIZABLE_ID);
// FIXME OAK-396: rep:principalName only needs to be unique if defined with user/group nodes -> add defining nt-info to uniqueness constraint otherwise ac-editing will fail.
IndexUtils.createIndexDefinition(index, "principalName", true, UserConstants.REP_PRINCIPAL_NAME);
IndexUtils.createIndexDefinition(index, "members", false, UserConstants.REP_MEMBERS);
String adminId = userConfiguration.getConfigurationParameters().getConfigValue(PARAM_ADMIN_ID, DEFAULT_ADMIN_ID);
if (userManager.getAuthorizable(adminId) == null) {
// TODO: init admin with null password and force application to set it.
userManager.createUser(adminId, adminId);
}
String anonymousId = userConfiguration.getConfigurationParameters().getConfigValue(PARAM_ANONYMOUS_ID, DEFAULT_ANONYMOUS_ID);
if (userManager.getAuthorizable(anonymousId) == null) {
userManager.createUser(anonymousId, null);
}
if (root.hasPendingChanges()) {
root.commit();
}
} catch (RepositoryException e) {
log.error("Failed to initialize user content ", e);
throw new RuntimeException(e);
} catch (CommitFailedException e) {