|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
import org.hibernate.Query;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
|
|
|
|
import org.springframework.security.authentication.encoding.PasswordEncoder;
|
|
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
|
@ -21,6 +22,8 @@ import info.bukova.isspst.services.AbstractService;
|
|
|
|
|
public class UserServiceImpl extends AbstractService<User> implements UserService {
|
|
|
|
|
|
|
|
|
|
private PasswordEncoder encoder;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RoleService roleService;
|
|
|
|
|
|
|
|
|
|
public void setEncoder(PasswordEncoder encoder) {
|
|
|
|
|
this.encoder = encoder;
|
|
|
|
@ -114,5 +117,16 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
|
|
|
|
return q.list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected User createEntity() {
|
|
|
|
|
User u = new User();
|
|
|
|
|
Role r = roleService.getRoleByAuthority(Constants.ROLE_USER);
|
|
|
|
|
if (r != null) {
|
|
|
|
|
u.addAuthority(r);
|
|
|
|
|
}
|
|
|
|
|
u.setEnabled(true);
|
|
|
|
|
return u;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|