public User saveTestUser(String name) throws Exception { final User user = new User(name + "@pleasedontsendmailshere.com", name, "secret", "test", "test", true); user.setCompanyName("enwida.de"); userService.saveUser(user, false); return user; }
public User saveUserWithGroup(String username) throws Exception { final User user = new User("*****@*****.**", username, "secret", "test", "test", true); user.setCompanyName("enwida.de"); userService.saveUser(user, false); final Group group = new Group("testgroup"); userService.saveGroup(group); userService.assignGroupToUser(user, group); return user; }
public void cleanupDatabase() throws Exception { for (final Right right : userService.fetchAllRights()) { userService.deleteRight(right.getRightID()); } for (final Role role : userService.fetchAllRoles()) { userService.deleteRole(role.getRoleID()); } for (final Group group : userService.fetchAllGroups()) { userService.deleteGroup(group.getGroupID()); } for (final User user : userService.fetchAllUsers()) { userService.deleteUser(user.getUserId()); } }
public Role saveRight(User user, Right right) throws Exception { userService.saveRight(right); return userService.enableDisableAspect(right, user.getAllRoles().get(0), true); }
public Role saveRole(User user, String roleName) throws Exception { final Role role = new Role(roleName); userService.saveRole(role); return userService.assignRoleToGroup(role, user.getGroups().iterator().next()); }