Added UserRepositoryTest and users/admin users/deanery
Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
@ -30,7 +30,7 @@ public class UserService {
|
||||
|
||||
public User checkForUser(String email, String usosId, UserRoles roleIfNotExist) {
|
||||
if (usosId == null) {
|
||||
Optional<User> user = this.repo.getByAuthority(email.replace("\n", "").trim());
|
||||
Optional<User> user = this.repo.getByEmail(email.replace("\n", "").trim());
|
||||
if (user.isPresent()) {
|
||||
return user.get();
|
||||
} else {
|
||||
@ -64,11 +64,15 @@ public class UserService {
|
||||
}
|
||||
|
||||
public User getUserByEmail(String email) throws UserNotFoundException {
|
||||
return this.repo.getByAuthority(email.replace("\n", "").trim())
|
||||
return this.repo.getByEmail(email.replace("\n", "").trim())
|
||||
.orElseThrow(() -> new UserNotFoundException("Cannot find user with given authority"));
|
||||
|
||||
}
|
||||
|
||||
public Optional<User> getByAuthority(String authority) {
|
||||
return this.repo.getByAuthority(authority);
|
||||
}
|
||||
|
||||
public Optional<User> getByToken(String token) {
|
||||
return this.repo.getByToken(token);
|
||||
}
|
||||
|
Reference in New Issue
Block a user