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 in which he works. This I managed to do, but whenever someone logs into the system it replaces the data of the current session with the session that was last entered. I created a Userstatic that made the user only see what is on its drive, but whenever someone enters it overwrites the data. I posted the code of my loginControl, because that’s where when a user enters it arrow to the userStatic a new user. If anyone knows a new way to do that.
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));
A static user won’t even work.
– DiegoAugusto
This snippet you posted is from your right User Bean?
– DiegoAugusto
is my bean Login, tbm I have user
– Leandro Santos
Well they passed me the information to use Static user, as I should do then ?
– Leandro Santos
I answered your question, I do not know if I was very clear but any doubt is only speak.
– DiegoAugusto