See ChangeLog

Monotone-Parent: be9e28d5d42ed05605b27d2127cf29b07678495b
Monotone-Revision: 5de6a9584cf27a2c1dad8d1ab8b84fc9ddab2720

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2011-04-25T10:31:08
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2011-04-25 10:31:08 +00:00
parent 326d376e6d
commit 12856abe4d
23 changed files with 340 additions and 74 deletions
+61 -3
View File
@@ -170,6 +170,9 @@ static NSArray *commonSearchFields;
searchAttributes = nil;
passwordPolicy = NO;
kindField = nil;
multipleBookingsField = nil;
_dnCache = [[NSMutableDictionary alloc] init];
}
@@ -198,6 +201,8 @@ static NSArray *commonSearchFields;
[searchAttributes release];
[domain release];
[_dnCache release];
[kindField release];
[multipleBookingsField release];
[super dealloc];
}
@@ -226,7 +231,9 @@ static NSArray *commonSearchFields;
searchFields: [udSource objectForKey: @"SearchFieldNames"]
IMAPHostField: [udSource objectForKey: @"IMAPHostFieldName"]
IMAPLoginField: [udSource objectForKey: @"IMAPLoginFieldName"]
andBindFields: [udSource objectForKey: @"bindFields"]];
bindFields: [udSource objectForKey: @"bindFields"]
kindField: [udSource objectForKey: @"KindFieldName"]
andMultipleBookingsField: [udSource objectForKey: @"MultipleBookingsFieldName"]];
if ([sourceDomain length])
{
@@ -309,7 +316,9 @@ static NSArray *commonSearchFields;
searchFields: (NSArray *) newSearchFields
IMAPHostField: (NSString *) newIMAPHostField
IMAPLoginField: (NSString *) newIMAPLoginField
andBindFields: (id) newBindFields
bindFields: (id) newBindFields
kindField: (NSString *) newKindField
andMultipleBookingsField: (NSString *) newMultipleBookingsField
{
ASSIGN (baseDN, [newBaseDN lowercaseString]);
if (newIDField)
@@ -349,6 +358,10 @@ static NSArray *commonSearchFields;
ASSIGN(bindFields, [newBindFields componentsSeparatedByString: @","]);
}
}
if (newKindField)
ASSIGN(kindField, newKindField);
if (newMultipleBookingsField)
ASSIGN(multipleBookingsField, newMultipleBookingsField);
}
- (BOOL) _setupEncryption: (NGLdapConnection *) encryptedConn
@@ -704,6 +717,13 @@ static NSArray *commonSearchFields;
// Add IMAP login from user defaults
if ([IMAPLoginField length])
[searchAttributes addObjectUniquely: IMAPLoginField];
// Add the resources handling attributes
if ([kindField length])
[searchAttributes addObjectUniquely: kindField];
if ([multipleBookingsField length])
[searchAttributes addObjectUniquely: multipleBookingsField];
}
return searchAttributes;
@@ -855,6 +875,14 @@ static NSArray *commonSearchFields;
[contactEntry 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"])
{
[contactEntry setObject: [NSNumber numberWithInt: 1]
forKey: @"isResource"];
}
}
while ((currentAttribute = [attributes nextObject]))
@@ -864,7 +892,37 @@ static NSArray *commonSearchFields;
// It's important here to set our attributes' key in lowercase.
if (value)
[contactEntry setObject: value forKey: [currentAttribute lowercaseString]];
{
currentAttribute = [currentAttribute lowercaseString];
[contactEntry setObject: value forKey: currentAttribute];
// We check if that entry corresponds to a resource. For this,
// kindField must be defined and it must hold one of those values
//
// location
// thing
// group
//
if (kindField &&
[kindField caseInsensitiveCompare: currentAttribute] == NSOrderedSame)
{
if ([value caseInsensitiveCompare: @"location"] == NSOrderedSame ||
[value caseInsensitiveCompare: @"thing"] == NSOrderedSame ||
[value caseInsensitiveCompare: @"group"] == NSOrderedSame)
{
[contactEntry setObject: [NSNumber numberWithInt: 1]
forKey: @"isResource"];
}
}
// We check for the number of simultanous bookings that is allowed.
// A value of 0 means that there's no limit.
if (multipleBookingsField &&
[multipleBookingsField caseInsensitiveCompare: currentAttribute] == NSOrderedSame)
{
[contactEntry setObject: [NSNumber numberWithInt: [value intValue]]
forKey: @"numberOfSimultaneousBookings"];
}
}
}
value = [[ldapEntry attributeWithName: IDField] stringValueAtIndex: 0];