Example #1
0
 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;
 }
Example #2
0
  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;
  }
Example #3
0
 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());
   }
 }
Example #4
0
 public Role saveRight(User user, Right right) throws Exception {
   userService.saveRight(right);
   return userService.enableDisableAspect(right, user.getAllRoles().get(0), true);
 }
Example #5
0
 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());
 }