private void createDefaultPages(User managedUser) { // Create profile page pageRepository.createPageForUser( managedUser, pageTemplateRepository.getDefaultPage(PageType.PERSON_PROFILE)); // Create default page set try { JSONArray obj = new JSONArray(messages.getMessage("user.pages.json", null, null, null)); for (int i = 0; i < obj.length(); i++) { JSONObject o = obj.getJSONObject(i); Page page = pageRepository.createPageForUser( managedUser, pageTemplateRepository.getDefaultPage(PageType.USER)); page.setName(o.getString("pName")); page.setPageLayout(pageLayoutRepository.getByPageLayoutCode(o.getString("layout"))); pageRepository.save(page); } } catch (JSONException ex) { LOG.log(Level.SEVERE, null, ex); } String storageUrl = cmisBaseUrl + "/_" + HttpUtils.generateId(managedUser.getUsername()); PersonPropertyImpl pp = new PersonPropertyImpl(); pp.setType("urls"); pp.setValue("storageUrl: " + storageUrl); managedUser.getProperties().add(pp); }
@Transactional @Override public UserAccount registerNewAccount(User user, String type) { HashSet auth = new HashSet(); String accountId = user.getUsername(); auth.add(new AuthorityImpl("ROLE_USER")); user.setAuthorities(auth); user.setDefaultPageLayout(pageLayoutRepository.getByPageLayoutCode("columns_1")); User managedUser = userRepository.save(user); createDefaultPages(managedUser); createUserHome(accountId); UserAccount uac = new UserAccountImpl(); uac.setUser(managedUser); uac.setAccountId(accountId); uac.setAccountType(type); return uacRepository.save(uac); }
@Transactional @Override public void registerNewUser(User user) { HashSet auth = new HashSet(); auth.add(new AuthorityImpl("ROLE_USER")); user.setAuthorities(auth); user.setDefaultPageLayout(pageLayoutRepository.getByPageLayoutCode("columns_1")); try { user.setPassword(new String(PwdUtils.cryptPassword(user.getPassword().toCharArray()))); } catch (NoSuchAlgorithmException ex) { throw new RuntimeException(ex); } User managedUser = userRepository.save(user); createDefaultPages(managedUser); createUserHome(managedUser.getUsername()); }