Package com.pe.pgn.clubpgn.model

Examples of com.pe.pgn.clubpgn.model.Role


            } else if (!StringUtils.isBlank(userId) && !"".equals(request.getParameter("version"))) {
                user = getUserManager().getUser(userId);
               
            } else {
                user = new User();
                user.addRole(new Role(Constants.USER_ROLE));
            }
           
            List<ClpbEstacion> estaciones = getUserManager().obtenerEstaciones();
            request.getSession().setAttribute("estaciones", estaciones);
           
View Full Code Here


        getHibernateTemplate().delete(role);
    }
   
    public Role getRole(Long id){
     
      Role role = get(id);
      return role;
    }
View Full Code Here

   
    if(ValidationUtil.validateList(list)){
      for (int i = 0; i < list.size(); i++) {
       
        Map map = (Map)list.get(i);
        Role bnrol = new Role();
        bnrol.setId(new Long(map.get("ID").toString()));
        bnrol.setName(map.get("NAME").toString());
        listFinal.add(bnrol);
      }
     
    }
   
View Full Code Here

   
    List<Role> roles = roleDao.getRolesByCoUser(usuario.getId());
    Collection<GrantedAuthority> collection = new HashSet<GrantedAuthority>();
   
    for (int i=0; i<roles.size();i++) {
      Role role = roles.get(i);
      GrantedAuthority autoridad = new GrantedAuthorityImpl(role.getName());
      collection.add(autoridad);
    }
   
    UsernamePasswordAuthenticationToken result = new
    UsernamePasswordAuthenticationToken(usuario, password, collection);
View Full Code Here

                } else if (user.getId() != null && user.getId().equals(currentUser.getId()) && !administrator) {
                    // get the list of roles the user is trying add
                    Set<String> userRoles = new HashSet<String>();
                    if (user.getRoles() != null) {
                        for (Object o : user.getRoles()) {
                            Role role = (Role) o;
                            userRoles.add(role.getName());
                        }
                    }

                    // get the list of roles the user currently has
                    Set<String> authorizedRoles = new HashSet<String>();
                    for (GrantedAuthority role : roles) {
                        authorizedRoles.add(role.getAuthority());
                    }

                    // if they don't match - access denied
                    // regular users aren't allowed to change their roles
                    if (!CollectionUtils.isEqualCollection(userRoles, authorizedRoles)) {
View Full Code Here

 
  @RequestMapping(value = "/roleform.html", method = RequestMethod.GET)
  public @ModelAttribute("role") Role verRole(
        @RequestParam(value = "id", required = false) Long id, Model model) {

    Role role = new Role();
    if (id != null) {     
     
      role = roleManager.getRole(id);   
     
      List<OpcionMenu> opcionesMenu = opcionMenuService.obtenerOpcionesMenuPorRol(role.getId());
      role.setOpcionesMenu(opcionesMenu);
     
      List<OpcionMenu> opcionesMenuNoElegidas = opcionMenuService.obtenerOpcionesMenuNoEnRol(role.getId());
      role.getOpcionesMenu().addAll(opcionesMenuNoElegidas);
     
      boolean esRoleConDependencias = roleManager.esRoleConDependencias(id);
      if(esRoleConDependencias){
        model.addAttribute(ES_EDITABLE, Boolean.FALSE)
      }else{
        model.addAttribute(ES_EDITABLE, Boolean.TRUE)
      }
     
      return role;
    }
   
    List<OpcionMenu> opcionesMenu = opcionMenuService.obtenerTodasOpcionesMenu();
    role.setOpcionesMenu(opcionesMenu)
    model.addAttribute(ES_EDITABLE, Boolean.TRUE)
   
    return role;
  }
View Full Code Here

   
    User user = getUsuarioLogueado();
    String string = "";
    for(Iterator<Role> iterRole = user.getRoles().iterator(); iterRole.hasNext(); ){
     
      Role role = iterRole.next();
      string = string.concat(role.getId().toString());
      if(iterRole.hasNext()){
        string = string.concat(",");
      }     
    }   
    return string;   
View Full Code Here

TOP

Related Classes of com.pe.pgn.clubpgn.model.Role

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.