diff --git a/ChangeLog b/ChangeLog index 85c0e71a7..00c96993d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-08-14 Wolfgang Sourdeau + + * SoObjects/Contacts/NGLdapEntry+Contact.m ([NGLdapEntry + -asDictionaryWithAttributeNames:withUID:andCName:cName]): add an + entry for "uid" with the field name representing the login name of + the user in the corresponding LDAP branch. + 2006-08-10 Wolfgang Sourdeau * SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder diff --git a/SoObjects/Contacts/NGLdapEntry+Contact.h b/SoObjects/Contacts/NGLdapEntry+Contact.h index 557911724..0551e6110 100644 --- a/SoObjects/Contacts/NGLdapEntry+Contact.h +++ b/SoObjects/Contacts/NGLdapEntry+Contact.h @@ -33,6 +33,7 @@ - (NSString *) singleAttributeWithName: (NSString *) key; - (NSDictionary *) asDictionaryWithAttributeNames: (NSArray *) attributes + withUID: (NSString *) uid andCName: (NSString *) cName; @end diff --git a/SoObjects/Contacts/NGLdapEntry+Contact.m b/SoObjects/Contacts/NGLdapEntry+Contact.m index 880f7b779..60aabf0cc 100644 --- a/SoObjects/Contacts/NGLdapEntry+Contact.m +++ b/SoObjects/Contacts/NGLdapEntry+Contact.m @@ -37,11 +37,12 @@ } - (NSDictionary *) asDictionaryWithAttributeNames: (NSArray *) attributeNames + withUID: (NSString *) uid andCName: (NSString *) cName { NSMutableDictionary *valuesDict; NSEnumerator *attrEnum; - NSString *attribute; + NSString *attribute, *value; if (!attributeNames) attributeNames = [self attributeNames]; @@ -56,9 +57,26 @@ forKey: attribute]; attribute = [attrEnum nextObject]; } - [valuesDict setObject: [[self attributeWithName: cName] - stringValueAtIndex: 0] - forKey: @"c_name"]; + if (cName) + { + value = [[self attributeWithName: cName] + stringValueAtIndex: 0]; + if (!value) + value = @""; + NSLog (@"value for '%@' = '%@'", cName, value); + [valuesDict setObject: value + forKey: @"c_name"]; + } + if (uid) + { + value = [[self attributeWithName: uid] + stringValueAtIndex: 0]; + if (!value) + value = @""; + NSLog (@"value for '%@' = '%@'", uid, value); + [valuesDict setObject: value + forKey: @"c_uid"]; + } return valuesDict; }