WikiUtil.validateUserName(user.getUsername());
try {
// status = DatabaseConnection.startTransaction();
if (user.getUserId() == null) {
WikiUserDetails userDetails = new WikiUserDetails(username, encryptedPassword, true, true, true, true,
JAMWikiAuthenticationConfiguration.getDefaultGroupRoles());
WikiUserDetailsService.save(userDetails);
WikiUserService.save(user);
// this.addWikiUser(user, conn);
// add all users to the registered user group
this.addGroupMember(user.getUsername(), WikiBase.getGroupRegisteredUser().getGroupId());
// FIXME - reconsider this approach of separate entries for every
// virtual wiki
// List<VirtualWiki> virtualWikis = this.getVirtualWikiList();
// for (VirtualWiki virtualWiki : virtualWikis) {
// LogItem logItem = LogItem.initLogItem(user, virtualWiki.getName());
// this.addLogItem(logItem, conn);
// RecentChange change = RecentChange.initRecentChange(logItem);
// this.addRecentChange(change, conn);
// }
} else {
if (!StringUtils.isBlank(encryptedPassword)) {
WikiUserDetails userDetails = new WikiUserDetails(username, encryptedPassword, true, true, true, true,
JAMWikiAuthenticationConfiguration.getDefaultGroupRoles());
// this.updateUserDetails(userDetails, conn);
}
// this.updateWikiUser(user, conn);
WikiUserService.update(user);