Refactored UserRepository.update to return user ID and updated SecurityConfig to handle returned value.
This commit is contained in:
parent
a28a14d1d3
commit
21e8a9e43a
2 changed files with 4 additions and 2 deletions
|
|
@ -288,7 +288,7 @@ public class SecurityConfig {
|
||||||
|
|
||||||
if (user == null && email != null && (ignoreWorkdayClaim || workdayId != null)) {
|
if (user == null && email != null && (ignoreWorkdayClaim || workdayId != null)) {
|
||||||
var isFirstUser = userRepository.count() == 0;
|
var isFirstUser = userRepository.count() == 0;
|
||||||
userRepository.update(LccOidcUser.createDatabaseUser(email, oidcUser.getGivenName(), oidcUser.getFamilyName(), ignoreWorkdayClaim ? email : workdayId, isFirstUser));
|
userId = userRepository.update(LccOidcUser.createDatabaseUser(email, oidcUser.getGivenName(), oidcUser.getFamilyName(), ignoreWorkdayClaim ? email : workdayId, isFirstUser));
|
||||||
mappedAuthorities.add(new SimpleGrantedAuthority(isFirstUser ? "ROLE_SERVICE" : "ROLE_NONE"));
|
mappedAuthorities.add(new SimpleGrantedAuthority(isFirstUser ? "ROLE_SERVICE" : "ROLE_NONE"));
|
||||||
} else {
|
} else {
|
||||||
log.debug("Unable to create user {} / {}", email, workdayId);
|
log.debug("Unable to create user {} / {}", email, workdayId);
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public class UserRepository {
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void update(User user) {
|
public Integer update(User user) {
|
||||||
|
|
||||||
Integer userId = getUserIdByWorkdayId(user.getWorkdayId());
|
Integer userId = getUserIdByWorkdayId(user.getWorkdayId());
|
||||||
|
|
||||||
|
|
@ -94,6 +94,8 @@ public class UserRepository {
|
||||||
|
|
||||||
updateUserGroupMappings(userId, groupIds);
|
updateUserGroupMappings(userId, groupIds);
|
||||||
|
|
||||||
|
return userId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue