See ChangeLog

Monotone-Parent: d29498142c4a9f1d780373bd5f0d80b17f6e2c33
Monotone-Revision: 747fe8c2134a990c1cdf3b494c2b7776021cb736

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2012-05-31T12:36:00
maint-2.0.2
Ludovic Marcotte 2012-05-31 12:36:00 +00:00
parent d98db782b3
commit 18ffca1924
4 changed files with 34 additions and 71 deletions

View File

@ -1,3 +1,10 @@
2012-05-31 Ludovic Marcotte <lmarcotte@inverse.ca>
* SoObjects/SOGo/SOGoGroup.m - we now handle lowercase
all attribute names
* SoObject/SOGo/LDAPSource.m - moved the lowercasing
of attributes to SOPE.
2012-05-29 Francis Lachapelle <flachapelle@inverse.ca> 2012-05-29 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/UIxMailEditor.js (validateEditorInput): * UI/WebServerResources/UIxMailEditor.js (validateEditorInput):

View File

@ -52,64 +52,6 @@ static Class NSStringK;
stringByReplacingString: @"'" withString: @"\\'"] \ stringByReplacingString: @"'" withString: @"\\'"] \
stringByReplacingString: @"%" withString: @"%%"] stringByReplacingString: @"%" withString: @"%%"]
@interface NGLdapAttribute (SOGoLDAP)
- (id) _asArrayOrString;
@end
@implementation NGLdapAttribute (SOGoLDAP)
- (id) _asArrayOrString
{
id value;
NSArray *arrayValue;
arrayValue = [self allStringValues];
if ([arrayValue count] == 1)
value = [arrayValue objectAtIndex: 0];
else
value = arrayValue;
return value;
}
@end
@interface NGLdapEntry (SOGoLDAP)
- (NSMutableDictionary *) _asDictionary;
@end
@implementation NGLdapEntry (SOGoLDAP)
- (NSMutableDictionary *) _asDictionary
{
NSMutableDictionary *ldapRecord;
NSDictionary *ldapAttributes;
NSArray *keys;
NSString *key;
NSUInteger count, max;
id value;
ldapAttributes = [self attributes];
keys = [ldapAttributes allKeys];
max = [keys count];
ldapRecord = [NSMutableDictionary dictionaryWithCapacity: max];
for (count = 0; count < max; count++)
{
key = [keys objectAtIndex: count];
value = [[ldapAttributes objectForKey: key] _asArrayOrString];
if (value)
[ldapRecord setObject: value forKey: [key lowercaseString]];
}
return ldapRecord;
}
@end
@implementation LDAPSource @implementation LDAPSource
@ -1018,7 +960,7 @@ andMultipleBookingsField: (NSString *) newMultipleBookingsField
resourceKinds = [[NSArray alloc] initWithObjects: @"location", @"thing", resourceKinds = [[NSArray alloc] initWithObjects: @"location", @"thing",
@"group", nil]; @"group", nil];
ldifRecord = [ldapEntry _asDictionary]; ldifRecord = [ldapEntry asDictionary];
[ldifRecord setObject: self forKey: @"source"]; [ldifRecord setObject: self forKey: @"source"];
[ldifRecord setObject: [ldapEntry dn] forKey: @"dn"]; [ldifRecord setObject: [ldapEntry dn] forKey: @"dn"];
@ -1645,7 +1587,7 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
modifier = [NSArray arrayWithObject: user]; modifier = [NSArray arrayWithObject: user];
while ((entry = [entries nextObject])) while ((entry = [entries nextObject]))
{ {
sourceRec = [entry _asDictionary]; sourceRec = [entry asDictionary];
ab = [LDAPSource new]; ab = [LDAPSource new];
[ab setSourceID: [sourceRec objectForKey: @"ou"]]; [ab setSourceID: [sourceRec objectForKey: @"ou"]];
[ab setDisplayName: [sourceRec objectForKey: @"description"]]; [ab setDisplayName: [sourceRec objectForKey: @"description"]];

View File

@ -1,6 +1,6 @@
/* SOGoGroup.h - this file is part of SOGo /* SOGoGroup.h - this file is part of SOGo
* *
* Copyright (C) 2009-2010 Inverse inc. * Copyright (C) 2009-2012 Inverse inc.
* *
* Author: Ludovic Marcotte <lmarcotte@inverse.ca> * Author: Ludovic Marcotte <lmarcotte@inverse.ca>
* *

View File

@ -1,6 +1,6 @@
/* SOGoGroup.m - this file is part of SOGo /* SOGoGroup.m - this file is part of SOGo
* *
* Copyright (C) 2009-2011 Inverse inc. * Copyright (C) 2009-2012 Inverse inc.
* *
* Author: Ludovic Marcotte <lmarcotte@inverse.ca> * Author: Ludovic Marcotte <lmarcotte@inverse.ca>
* *
@ -57,6 +57,7 @@
#include "SOGoGroup.h" #include "SOGoGroup.h"
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
#include "SOGoCache.h" #include "SOGoCache.h"
@ -163,15 +164,26 @@
if (entry) if (entry)
{ {
NSArray *classes; NSArray *classes;
// We check to see if it's a group // We check to see if it's a group
classes = [[entry attributeWithName: @"objectClass"] allStringValues]; classes = [[entry asDictionary] objectForKey: @"objectclass"];
if (classes)
{
int i, c;
classes = [NSMutableArray arrayWithArray: classes];
c = [classes count];
for (i = 0; i < c; i++)
[(id)classes replaceObjectAtIndex: i
withObject: [[classes objectAtIndex: i] lowercaseString]];
}
// Found a group, let's return it. // Found a group, let's return it.
if ([classes containsObject: @"group"] || if ([classes containsObject: @"group"] ||
[classes containsObject: @"groupOfNames"] || [classes containsObject: @"groupofnames"] ||
[classes containsObject: @"groupOfUniqueNames"] || [classes containsObject: @"groupofuniquenames"] ||
[classes containsObject: @"posixGroup"]) [classes containsObject: @"posixgroup"])
{ {
o = [[self alloc] initWithIdentifier: theValue o = [[self alloc] initWithIdentifier: theValue
domain: domain domain: domain
@ -192,9 +204,10 @@
{ {
NSMutableArray *dns, *uids, *logins; NSMutableArray *dns, *uids, *logins;
NSString *dn, *login; NSString *dn, *login;
SOGoUserManager *um;
NSDictionary *d;
SOGoUser *user; SOGoUser *user;
NSArray *o; NSArray *o;
SOGoUserManager *um;
int i, c; int i, c;
if (!_members) if (!_members)
@ -206,15 +219,16 @@
// We check if it's a static group // We check if it's a static group
// Fetch "members" - we get DNs // Fetch "members" - we get DNs
o = [[_entry attributeWithName: @"member"] allStringValues]; d = [_entry asDictionary];
o = [d objectForKey: @"member"];
if (o) [dns addObjectsFromArray: o]; if (o) [dns addObjectsFromArray: o];
// Fetch "uniqueMembers" - we get DNs // Fetch "uniqueMembers" - we get DNs
o = [[_entry attributeWithName: @"uniqueMember"] allStringValues]; o = [d objectForKey: @"uniquemember"];
if (o) [dns addObjectsFromArray: o]; if (o) [dns addObjectsFromArray: o];
// Fetch "memberUid" - we get UID (like login names) // Fetch "memberUid" - we get UID (like login names)
o = [[_entry attributeWithName: @"memberUid"] allStringValues]; o = [d objectForKey: @"memberuid"];
if (o) [uids addObjectsFromArray: o]; if (o) [uids addObjectsFromArray: o];
c = [dns count] + [uids count]; c = [dns count] + [uids count];