Package com.commafeed.backend.model

Examples of com.commafeed.backend.model.UserRole


      u.setDisabled(!userModel.isEnabled());
      userDAO.saveOrUpdate(u);

      Set<Role> roles = userRoleDAO.findRoles(u);
      if (userModel.isAdmin() && !roles.contains(Role.ADMIN)) {
        userRoleDAO.saveOrUpdate(new UserRole(u, Role.ADMIN));
      } else if (!userModel.isAdmin() && roles.contains(Role.ADMIN)) {
        if (CommaFeedApplication.USERNAME_ADMIN.equals(u.getName())) {
          return Response.status(Status.FORBIDDEN).entity("You cannot remove the admin role from the admin user.").build();
        }
        for (UserRole userRole : userRoleDAO.findAll(u)) {
View Full Code Here


    user.setEmail(email);
    user.setCreated(new Date());
    user.setSalt(salt);
    user.setPassword(encryptionService.getEncryptedPassword(password, salt));
    for (Role role : roles) {
      user.getRoles().add(new UserRole(user, role));
    }
    userDAO.saveOrUpdate(user);
    return user;
  }
View Full Code Here

TOP

Related Classes of com.commafeed.backend.model.UserRole

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.