mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 00:48:49 +00:00
guardando presupuestos anonimos
This commit is contained in:
@ -2,6 +2,8 @@ package com.imprimelibros.erp.users;
|
||||
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@ -13,10 +15,19 @@ public class UserServiceImpl implements UserService {
|
||||
this.userDao = userDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) {
|
||||
User user = userDao.findByUserNameIgnoreCaseAndEnabledTrueAndDeletedFalse(username)
|
||||
.orElseThrow(() -> new UsernameNotFoundException("No existe usuario activo: " + username));
|
||||
return new UserDetailsImpl(user);
|
||||
}
|
||||
|
||||
// ===== Búsqueda para Select2 =====
|
||||
@Override
|
||||
public Page<User> findByRoleAndSearch(String role, String query, Pageable pageable) {
|
||||
|
||||
if (query == null || query.isBlank()) query = null;
|
||||
return userDao.searchUsers(role, query, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user