Extended UserDTO to also include the user's locale

This commit is contained in:
Steffen Schaefer committed 2016-07-13 13:32:46 +02:00
1 parent b741d72f91
commit 1b0c923bb1
3 files changed
+9 -3

No files matched your search

@@ -11,7 +11,7 @@ import com.sap.sse.security.ui.shared.UserDTO;
public class AuthenticationContextImpl implements AuthenticationContext {
private final UserDTO currentUser;
private final static UserDTO ANONYMOUS = new UserDTO("Anonymous", "", "", "", false, new ArrayList<AccountDTO>(),
private final static UserDTO ANONYMOUS = new UserDTO("Anonymous", "", "", "", null, false, new ArrayList<AccountDTO>(),
new ArrayList<String>(), new ArrayList<String>());
/**
@@ -302,7 +302,8 @@ public class UserManagementServiceImpl extends RemoteServiceServlet implements U
}
}
userDTO = new UserDTO(user.getName(), user.getEmail(), user.getFullName(), user.getCompany(),
user.isEmailValidated(), accountDTOs, user.getRoles(), user.getPermissions());
user.getLocale() != null ? user.getLocale().toLanguageTag() : null, user.isEmailValidated(),
accountDTOs, user.getRoles(), user.getPermissions());
return userDTO;
}
@@ -16,6 +16,7 @@ public class UserDTO implements IsSerializable {
private String email;
private String fullName;
private String company;
private String locale;
private List<AccountDTO> accounts;
private Set<String> roles;
private Set<WildcardPermission> permissions;
@@ -23,7 +24,7 @@ public class UserDTO implements IsSerializable {
UserDTO() {} // for serialization only
public UserDTO(String name, String email, String fullName, String company, boolean emailValidated,
public UserDTO(String name, String email, String fullName, String company, String locale, boolean emailValidated,
List<AccountDTO> accounts, Iterable<String> roles, Iterable<String> stringPermissions) {
this.name = name;
this.email = email;
@@ -50,6 +51,10 @@ public class UserDTO implements IsSerializable {
public String getCompany() {
return company;
}
public String getLocale() {
return locale;
}
public Iterable<String> getRoles() {
return roles;