User to see only Items of the Operational unit that is in your register

0

I have a vehicle management system. The company in which I work has several business units, so the user can only see the cars of the unit on which he works. This I was able to do, but whenever someone logs in the system it replaces the data of the current session with the session that entered last. I created a UserStatic that made the user see only what is on his drive, but every time someone logs in he replaces the data. I put the code of my loginControle, because it is there that when a user enters it arrow to the userStatic a new user. If anyone knows a new way to do this.

 public String logar() {
    usuario = usuarioFacade.buscarUsuario(login, senha);
    if (usuario != null) {
        List<GrantedAuthority> roles = new ArrayList<>();
        roles.add(new GrantedAuthorityImpl(usuario.getPermissaoUsuario().toString()));
        UserStatic.setUsuario(usuario);
        SecurityContext context = SecurityContextHolder.getContext();
        context.setAuthentication(new UsernamePasswordAuthenticationToken(
                login, senha, roles));
    
asked by anonymous 14.09.2016 / 18:57

1 answer

0

Well, I think the problem is with your UserStatic . From one in that excerpt that I removed from a

14.09.2016 / 19:52