Skip to content
Snippets Groups Projects
Commit 03f08219 authored by Mounir Nayab's avatar Mounir Nayab
Browse files

[FENIX-58] add siteCode to user

parent d98d58ec
No related branches found
No related tags found
1 merge request!1Feature/design/1
......@@ -89,6 +89,8 @@ public class UserConverter implements Converter<UserDto, User> {
*/
public static final String BLOCKED_DURATION = "Durée du blocage";
public static final String SITE_CODE = "siteCode";
private final GroupRepository groupRepository;
private final AddressConverter addressConverter;
......@@ -111,6 +113,7 @@ public class UserConverter implements Converter<UserDto, User> {
userLogbookData.put(STATUS_KEY, LogbookUtils.getValue(user.getStatus().toString()));
userLogbookData.put(SUBROGEABLE_KEY, LogbookUtils.getValue(user.isSubrogeable()));
userLogbookData.put(OTP_KEY, LogbookUtils.getValue(user.isOtp()));
userLogbookData.put(SITE_CODE, LogbookUtils.getValue(user.getSiteCode()));
AddressDto address = user.getAddress() != null ? user.getAddress() : new AddressDto();
addressConverter.addAddress(address, userLogbookData);
Optional<Group> group = groupRepository.findById(user.getGroupId());
......
......@@ -129,4 +129,6 @@ public class User extends CustomerIdDocument implements BaseIdentifierDocument {
private OffsetDateTime passwordExpirationDate;
private Address address = new Address();
private String siteCode;
}
......@@ -217,6 +217,7 @@ public class UserPrincipalResolver implements PrincipalResolver {
attributes.put(AUTHTOKEN_ATTRIBUTE, Collections.singletonList(authUser.getAuthToken()));
attributes.put(PROOF_TENANT_ID_ATTRIBUTE, Collections.singletonList(authUser.getProofTenantIdentifier()));
attributes.put(TENANTS_BY_APP_ATTRIBUTE, Collections.singletonList(new CasJsonWrapper(authUser.getTenantsByApp())));
attributes.put("siteCode", Collections.singletonList(user.getSiteCode()));
final Set<String> roles = new HashSet<>();
final List<ProfileDto> profiles = authUser.getProfileGroup().getProfiles();
profiles.forEach(profile -> profile.getRoles().forEach(role -> roles.add(role.getName())));
......
......@@ -110,4 +110,6 @@ public class UserDto extends CustomerIdDto {
private OffsetDateTime passwordExpirationDate;
private AddressDto address = new AddressDto();
private String siteCode;
}
......@@ -116,6 +116,8 @@ public class AuthUserDto extends UserDto implements UserDetails {
setNbFailedAttempts(user.getNbFailedAttempts());
setPasswordExpirationDate(user.getPasswordExpirationDate());
setGroupId(user.getGroupId());
System.out.println("------------------------UserDto--------------------" + user);
setSiteCode(user.getSiteCode());
}
public AuthUserDto(final String username, final Map<String, Object> attributes) {
......@@ -244,6 +246,9 @@ public class AuthUserDto extends UserDto implements UserDetails {
setTenantsByApp((List<TenantInformationDto>) parseJson(value, new TypeReference<List<TenantInformationDto>>() {
}));
break;
case "siteCode" :
setSiteCode((String) value);
break;
}
}
}
......@@ -296,6 +301,7 @@ public class AuthUserDto extends UserDto implements UserDetails {
user.setNbFailedAttempts(getNbFailedAttempts());
user.setPasswordExpirationDate(getPasswordExpirationDate());
user.setGroupId(getGroupId());
user.setSiteCode(getSiteCode());
return user;
}
}
......@@ -56,5 +56,5 @@ export interface AuthUser extends User {
username: string;
customerIdentifier: string;
basicCustomer: BasicCustomer;
siteCode: string;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment