90919293949596979899100
assertNotNull(user); assertEquals(testUser, user); // modify user and save user.setFullName("testtesttest"); mgr.saveUser(user); TestUtils.endSession(true); // make sure changes were saved user = null; user = mgr.getUser(id);
152153154155156157158159160161162
assertNotNull(user); assertEquals(testUser.getUserName(), user.getUserName()); // make sure disable users are not returned user.setEnabled(Boolean.FALSE); mgr.saveUser(user); user = null; user = mgr.getUserByUserName(testUser.getUserName()); assertNull(user); // remove test user
184185186187188189190191192193194
assertTrue(user.hasRole("editor")); assertTrue(user.hasRole("admin")); // remove role user.revokeRole("admin"); mgr.saveUser(user); TestUtils.endSession(true); // check that role was removed user = null; user = mgr.getUserByUserName(testUser.getUserName());
197198199200201202203204205206207
assertTrue(user.hasRole("editor")); assertFalse(user.hasRole("admin")); // add role user.grantRole("admin"); mgr.saveUser(user); TestUtils.endSession(true); // check that role was added user = null; user = mgr.getUserByUserName(testUser.getUserName());
218219220221222223224225226227228
} if (msgs.isEmpty()) { try { // Persist changes to user mgr.saveUser(user); RollerFactory.getRoller().flush(); msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("userSettings.saved")); saveMessages(request, msgs);
202203204205206207208209210211212
ud.setEnabled(entry.getEnabled()); } try { UserManager mgr = getRoller().getUserManager(); mgr.saveUser(ud); getRoller().flush(); CacheManager.invalidate(ud); } catch (RollerException re) { throw new InternalException("ERROR: could not update user data", re); }
} } // save the updated profile UserManager mgr = RollerFactory.getRoller().getUserManager(); mgr.saveUser(data); RollerFactory.getRoller().flush(); request.setAttribute("model", new BasePageModel( "yourProfile.title", request, response, mapping));