mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-17 04:25:56 +00:00
(fix) respect the LDAP attributes mapping in the list view
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#import <SaxObjC/XMLNamespaces.h>
|
||||
|
||||
#import <SOGo/DOMNode+SOGo.h>
|
||||
#import <SOGo/LDAPSource.h>
|
||||
#import <SOGo/NSArray+Utilities.h>
|
||||
#import <SOGo/NSDictionary+Utilities.h>
|
||||
#import <SOGo/NSString+Utilities.h>
|
||||
@@ -257,7 +258,9 @@
|
||||
}
|
||||
[newRecord setObject: data forKey: @"c_mail"];
|
||||
|
||||
data = [oldRecord objectForKey: @"nsaimid"];
|
||||
data = [oldRecord objectForKey: @"mozillanickname"];
|
||||
if (![data length])
|
||||
data = [oldRecord objectForKey: @"nsaimid"];
|
||||
if (![data length])
|
||||
data = [oldRecord objectForKey: @"nscpaimscreenname"];
|
||||
if (![data length])
|
||||
@@ -313,15 +316,22 @@
|
||||
|
||||
- (NSArray *) _flattenedRecords: (NSArray *) records
|
||||
{
|
||||
NSMutableDictionary *oldRecord;
|
||||
NSMutableArray *newRecords;
|
||||
NSEnumerator *oldRecords;
|
||||
NSDictionary *oldRecord;
|
||||
NSDictionary *o;
|
||||
|
||||
newRecords = [NSMutableArray arrayWithCapacity: [records count]];
|
||||
|
||||
oldRecords = [records objectEnumerator];
|
||||
while ((oldRecord = [oldRecords nextObject]))
|
||||
[newRecords addObject: [self _flattenedRecord: oldRecord]];
|
||||
while ((o = [oldRecords nextObject]))
|
||||
{
|
||||
oldRecord = [NSMutableDictionary dictionary];
|
||||
[oldRecord addEntriesFromDictionary: o];
|
||||
if ([source isKindOfClass: [LDAPSource class]])
|
||||
[(LDAPSource *)source applyContactMappingToResult: oldRecord];
|
||||
[newRecords addObject: [self _flattenedRecord: oldRecord]];
|
||||
}
|
||||
|
||||
return newRecords;
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ andMultipleBookingsField: (NSString *) newMultipleBookingsField;
|
||||
- (NGLdapEntry *) lookupGroupEntryByEmail: (NSString *) theEmail
|
||||
inDomain: (NSString *) domain;
|
||||
|
||||
- (void) applyContactMappingToResult: (NSMutableDictionary *) ldifRecord;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* LDAPSOURCE_H */
|
||||
|
||||
@@ -972,7 +972,7 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
|
||||
}
|
||||
|
||||
/* conversion LDAP -> SOGo inetOrgPerson entry */
|
||||
- (void) _applyContactMappingToResult: (NSMutableDictionary *) ldifRecord
|
||||
- (void) applyContactMappingToResult: (NSMutableDictionary *) ldifRecord
|
||||
{
|
||||
NSArray *sourceFields;
|
||||
NSArray *keys;
|
||||
@@ -1172,7 +1172,7 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
|
||||
intoLDIFRecord: (NSMutableDictionary *) ldifRecord];
|
||||
|
||||
if (contactMapping)
|
||||
[self _applyContactMappingToResult: ldifRecord];
|
||||
[self applyContactMappingToResult: ldifRecord];
|
||||
|
||||
return ldifRecord;
|
||||
}
|
||||
@@ -1496,7 +1496,7 @@ _convertRecordToLDAPAttributes (LDAPSourceSchema *schema, NSDictionary *ldifReco
|
||||
[ldifRecord setObject: aId forKey: @"cn"];
|
||||
}
|
||||
|
||||
[self _applyContactMappingToOutput: ldifRecord];
|
||||
[self applyContactMappingToOutput: ldifRecord];
|
||||
|
||||
/* since the id might have changed due to the mapping above, we
|
||||
reload the record ID */
|
||||
@@ -1604,7 +1604,7 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
|
||||
ldapConnection = [self _ldapConnection];
|
||||
ldifRecord = [roLdifRecord mutableCopy];
|
||||
[ldifRecord autorelease];
|
||||
[self _applyContactMappingToOutput: ldifRecord];
|
||||
[self applyContactMappingToOutput: ldifRecord];
|
||||
attributes = _convertRecordToLDAPAttributes (schema, ldifRecord);
|
||||
|
||||
changes = _makeLDAPChanges (ldapConnection, dn, attributes);
|
||||
|
||||
Reference in New Issue
Block a user