Browse code

BM-15107 Fix: export user formated name as LDAP displayName if set

Anthony Prades authored on 06/08/2019 16:28:35
Showing 2 changed files
... ...
@@ -84,6 +84,10 @@ public class DomainDirectoryUserTests {
84 84
 		assertEquals(1, attrs.size());
85 85
 		assertEquals("Formated name", attrs.get(0));
86 86
 
87
+		attrs = getAttributeValues(entry, "displayName");
88
+		assertEquals(1, attrs.size());
89
+		assertEquals("Formated name", attrs.get(0));
90
+
87 91
 		attrs = getAttributeValues(entry, "sn");
88 92
 		assertEquals(1, attrs.size());
89 93
 		assertEquals("familyName", attrs.get(0));
... ...
@@ -193,7 +197,7 @@ public class DomainDirectoryUserTests {
193 197
 
194 198
 		ModifyRequest modificationRequest = ddu.getModifyRequest(currentEntry);
195 199
 		assertEquals("cn=dntoupdate", modificationRequest.getName().getName());
196
-		assertEquals(26, modificationRequest.getModifications().size());
200
+		assertEquals(27, modificationRequest.getModifications().size());
197 201
 	}
198 202
 
199 203
 	private ItemValue<Domain> getTestDomain() {
... ...
@@ -56,8 +56,8 @@ public class DomainDirectoryUser extends LdapObjects {
56 56
 	public static final List<String> ldapAttrsStringsValues = ImmutableList.of( //
57 57
 			"objectclass",
58 58
 			// Identity
59
-			"bmUid", "bmHidden", "cn", "sn", "employeeType", "givenName", "description", "ou", "departmentNumber",
60
-			"title", "jpegPhoto",
59
+			"bmUid", "bmHidden", "cn", "displayName", "sn", "employeeType", "givenName", "description", "ou",
60
+			"departmentNumber", "title", "jpegPhoto",
61 61
 			// Email
62 62
 			"mail",
63 63
 			// Phones
... ...
@@ -156,6 +156,7 @@ public class DomainDirectoryUser extends LdapObjects {
156 156
 	private void initIdentity(Entry ldapEntry) throws LdapException {
157 157
 		if (!Strings.isNullOrEmpty(user.value.contactInfos.identification.formatedName.value)) {
158 158
 			ldapEntry.add("cn", user.value.contactInfos.identification.formatedName.value);
159
+			ldapEntry.add("displayName", user.value.contactInfos.identification.formatedName.value);
159 160
 		} else {
160 161
 			ldapEntry.add("cn", user.value.login);
161 162
 		}