View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001499 | SOGo | Backend General | public | 2011-11-16 05:28 | 2015-03-24 12:41 |
Reporter | dab1818 | Assigned To | ludovic | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 1.3.9 | ||||
Target Version | 2.2.17 | Fixed in Version | 2.2.17 | ||
Summary | 0001499: LDAP group classes list must be configurable like 'SearchFieldNames'. | ||||
Description | now this list hardcoded in SoObjects/SOGo/LDAPSource.m/_convertLDAPEntryToContact. | ||||
Tags | No tags attached. | ||||
groupObjectClasses-2.2.16.patch allow to specify GroupObjectClasses in config: SOGoUserSources = ( i'm not sure about modifications in SOGoGroup.m, please correct me :) |
|
groupObjectClasses-2.2.16.patch (6,248 bytes)
--- SOGo-2.2.16/SoObjects/SOGo/LDAPSource.h.orig 2015-02-12 20:13:16.000000000 +0400 +++ SOGo-2.2.16/SoObjects/SOGo/LDAPSource.h 2015-03-24 11:33:21.105809603 +0400 @@ -72,6 +72,7 @@ NSDictionary *contactMapping; NSArray *contactObjectClasses; + NSArray *groupObjectClasses; NSDictionary *modulesConstraints; @@ -106,6 +107,7 @@ UIDField: (NSString *) newUIDField mailFields: (NSArray *) newMailFields searchFields: (NSArray *) newSearchFields +groupObjectClasses: (NSArray *) newGroupObjectClasses IMAPHostField: (NSString *) newIMAPHostField IMAPLoginField: (NSString *) newIMAPLoginField SieveHostField: (NSString *) newSieveHostField --- SOGo-2.2.16/SoObjects/SOGo/LDAPSource.m.orig 2015-02-12 20:13:16.000000000 +0400 +++ SOGo-2.2.16/SoObjects/SOGo/LDAPSource.m 2015-03-24 11:36:36.603875934 +0400 @@ -101,6 +101,8 @@ contactMapping = nil; searchFields = [NSArray arrayWithObjects: @"sn", @"displayname", @"telephonenumber", nil]; [searchFields retain]; + groupObjectClasses = [NSArray arrayWithObjects: @"group", @"groupofnames", @"groupofuniquenames", @"posixgroup", nil]; + [groupObjectClasses retain]; IMAPHostField = nil; IMAPLoginField = nil; SieveHostField = nil; @@ -144,6 +146,7 @@ [contactMapping release]; [mailFields release]; [searchFields release]; + [groupObjectClasses release]; [IMAPHostField release]; [IMAPLoginField release]; [SieveHostField release]; @@ -189,6 +192,7 @@ UIDField: [udSource objectForKey: @"UIDFieldName"] mailFields: [udSource objectForKey: @"MailFieldNames"] searchFields: [udSource objectForKey: @"SearchFieldNames"] + groupObjectClasses: [udSource objectForKey: @"GroupObjectClasses"] IMAPHostField: [udSource objectForKey: @"IMAPHostFieldName"] IMAPLoginField: [udSource objectForKey: @"IMAPLoginFieldName"] SieveHostField: [udSource objectForKey: @"SieveHostFieldName"] @@ -310,6 +314,7 @@ UIDField: (NSString *) newUIDField mailFields: (NSArray *) newMailFields searchFields: (NSArray *) newSearchFields +groupObjectClasses: (NSArray *) newGroupObjectClasses IMAPHostField: (NSString *) newIMAPHostField IMAPLoginField: (NSString *) newIMAPLoginField SieveHostField: (NSString *) newSieveHostField @@ -334,6 +339,8 @@ ASSIGN(mailFields, newMailFields); if (newSearchFields) ASSIGN(searchFields, newSearchFields); + if (newGroupObjectClasses) + ASSIGN(groupObjectClasses, newGroupObjectClasses); if (newBindFields) { // Before SOGo v1.2.0, bindFields was a comma-separated list @@ -1031,6 +1038,8 @@ NSString *value; static NSArray *resourceKinds = nil; NSMutableArray *classes; + NSEnumerator *gclasses; + NSString *gclass; id o; if (!resourceKinds) @@ -1059,24 +1068,27 @@ if (classes) { - // We check if our entry is a group. If so, we set the - // 'isGroup' custom attribute. - if ([classes containsObject: @"group"] || - [classes containsObject: @"groupofnames"] || - [classes containsObject: @"groupofuniquenames"] || - [classes containsObject: @"posixgroup"]) - { - [ldifRecord setObject: [NSNumber numberWithInt: 1] - forKey: @"isGroup"]; - } // We check if our entry is a resource. We also support // determining resources based on the KindFieldName attribute // value - see below. - else if ([classes containsObject: @"calendarresource"]) + if ([classes containsObject: @"calendarresource"]) { [ldifRecord setObject: [NSNumber numberWithInt: 1] forKey: @"isResource"]; } + else + { + // We check if our entry is a group. If so, we set the + // 'isGroup' custom attribute. + gclasses = [groupObjectClasses objectEnumerator]; + while (gclass = [gclasses nextObject]) + if ([classes containsObject: [gclass lowercaseString]]) + { + [ldifRecord setObject: [NSNumber numberWithInt: 1] + forKey: @"isGroup"]; + break; + } + } } // We check if that entry corresponds to a resource. For this, @@ -1368,6 +1380,11 @@ return modifiers; } +- (NSArray *) groupObjectClasses +{ + return groupObjectClasses; +} + static NSArray * _convertRecordToLDAPAttributes (LDAPSourceSchema *schema, NSDictionary *ldifRecord) { @@ -1683,6 +1700,7 @@ UIDField: @"cn" mailFields: nil searchFields: nil + groupObjectClasses: nil IMAPHostField: nil IMAPLoginField: nil SieveHostField: nil --- SOGo-2.2.16/SoObjects/SOGo/SOGoGroup.m.orig 2015-02-12 20:13:16.000000000 +0400 +++ SOGo-2.2.16/SoObjects/SOGo/SOGoGroup.m 2015-03-24 12:09:04.217945453 +0400 @@ -137,6 +137,8 @@ NGLdapEntry *entry; NSObject <SOGoSource> *source; id o; + NSEnumerator *gclasses; + NSString *gclass; int i; @@ -194,12 +196,11 @@ } } - // Found a group, let's return it. - if ([classes containsObject: @"group"] || - [classes containsObject: @"groupofnames"] || - [classes containsObject: @"groupofuniquenames"] || - [classes containsObject: @"posixgroup"]) - { + gclasses = [[source groupObjectClasses] objectEnumerator]; + while (gclass = [gclasses nextObject]) + if ([classes containsObject: gclass]) + { + // Found a group, let's return it. o = [[self alloc] initWithIdentifier: theValue domain: domain source: source --- SOGo-2.2.16/SoObjects/SOGo/SOGoSource.h.orig 2015-02-12 20:13:16.000000000 +0400 +++ SOGo-2.2.16/SoObjects/SOGo/SOGoSource.h 2015-03-24 11:34:22.598534713 +0400 @@ -110,6 +110,7 @@ - (NSString *) baseDN; - (NSString *) MSExchangeHostname; +- (NSArray *) groupObjectClasses; @end #endif /* SOGOSOURCE_H */ |
|
Fix + doc pushed: https://github.com/inverse-inc/sogo/commit/097d5c2333515092f03ace5e64fc6824682ba974 Thanks for your contribution! |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-11-16 05:28 | dab1818 | New Issue | |
2015-03-24 12:14 | dab1818 | Note Added: 0008354 | |
2015-03-24 12:15 | dab1818 | File Added: groupObjectClasses-2.2.16.patch | |
2015-03-24 12:40 | ludovic | Target Version | => 2.2.17 |
2015-03-24 12:41 | ludovic | Note Added: 0008355 | |
2015-03-24 12:41 | ludovic | Status | new => resolved |
2015-03-24 12:41 | ludovic | Fixed in Version | => 2.2.17 |
2015-03-24 12:41 | ludovic | Resolution | open => fixed |
2015-03-24 12:41 | ludovic | Assigned To | => ludovic |