mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-11 14:57:12 +00:00
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:
1 parent
326d376e6d
commit
12856abe4d
23 files changed
+340
-74
No files matched your search
@@ -68,6 +68,10 @@
|
||||
BOOL passwordPolicy;
|
||||
|
||||
NSMutableDictionary *_dnCache;
|
||||
|
||||
/* resources handling */
|
||||
NSString *kindField;
|
||||
NSString *multipleBookingsField;
|
||||
}
|
||||
|
||||
- (void) setBindDN: (NSString *) newBindDN
|
||||
@@ -85,7 +89,9 @@
|
||||
searchFields: (NSArray *) newSearchFields
|
||||
IMAPHostField: (NSString *) newIMAPHostField
|
||||
IMAPLoginField: (NSString *) newIMAPLoginField
|
||||
andBindFields: (id) newBindFields;
|
||||
bindFields: (id) newBindFields
|
||||
kindField: (NSString *) newKindField
|
||||
andMultipleBookingsField: (NSString *) newMultipleBookingsField;
|
||||
|
||||
- (NGLdapEntry *) lookupGroupEntryByUID: (NSString *) theUID;
|
||||
- (NGLdapEntry *) lookupGroupEntryByEmail: (NSString *) theEmail;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SOGoGroup.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2009-2010 Inverse inc.
|
||||
* Copyright (C) 2009-2011 Inverse inc.
|
||||
*
|
||||
* Author: Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2006-2010 Inverse inc.
|
||||
Copyright (C) 2006-2011 Inverse inc.
|
||||
Copyright (C) 2005 SKYRIX Software AG
|
||||
|
||||
This file is part of SOGo.
|
||||
@@ -114,16 +114,17 @@
|
||||
- (BOOL) isSuperUser;
|
||||
- (BOOL) canAuthenticate;
|
||||
|
||||
/* resource */
|
||||
- (BOOL) isResource;
|
||||
- (int) numberOfSimultaneousBookings;
|
||||
|
||||
/* module access */
|
||||
- (BOOL) canAccessModule: (NSString *) module;
|
||||
|
||||
/* folders */
|
||||
|
||||
- (SOGoUserFolder *) homeFolderInContext: (id) context;
|
||||
|
||||
- (SOGoAppointmentFolders *) calendarsFolderInContext: (WOContext *) context;
|
||||
- (SOGoAppointmentFolder *)
|
||||
personalCalendarFolderInContext: (WOContext *) context;
|
||||
- (SOGoAppointmentFolder *) personalCalendarFolderInContext: (WOContext *) context;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -766,6 +766,28 @@
|
||||
return [authValue boolValue];
|
||||
}
|
||||
|
||||
/* resource */
|
||||
- (BOOL) isResource
|
||||
{
|
||||
NSNumber *v;
|
||||
|
||||
v = [self _fetchFieldForUser: @"isResource"];
|
||||
|
||||
return (v && [v intValue]);
|
||||
}
|
||||
|
||||
- (int) numberOfSimultaneousBookings
|
||||
{
|
||||
NSNumber *v;
|
||||
|
||||
v = [self _fetchFieldForUser: @"numberOfSimultaneousBookings"];
|
||||
|
||||
if (v)
|
||||
return [v intValue];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* module access */
|
||||
- (BOOL) canAccessModule: (NSString *) module
|
||||
{
|
||||
|
||||
@@ -548,6 +548,9 @@
|
||||
[contact setObject: [emails objectAtIndex: 0] forKey: @"c_email"];
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
- (void) _fillContactInfosForUser: (NSMutableDictionary *) currentUser
|
||||
withUIDorEmail: (NSString *) uid
|
||||
{
|
||||
@@ -600,6 +603,15 @@
|
||||
if (!access)
|
||||
[currentUser setObject: [NSNumber numberWithBool: NO]
|
||||
forKey: @"MailAccess"];
|
||||
|
||||
// We also fill the resource attributes, if any
|
||||
if ([userEntry objectForKey: @"isResource"])
|
||||
[currentUser setObject: [userEntry objectForKey: @"isResource"]
|
||||
forKey: @"isResource"];
|
||||
if ([userEntry objectForKey: @"numberOfSimultaneousBookings"])
|
||||
[currentUser setObject: [userEntry objectForKey: @"numberOfSimultaneousBookings"]
|
||||
forKey: @"numberOfSimultaneousBookings"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,6 +626,7 @@
|
||||
[currentUser setObject: c_imaphostname forKey: @"c_imaphostname"];
|
||||
if (c_imaplogin)
|
||||
[currentUser setObject: c_imaplogin forKey: @"c_imaplogin"];
|
||||
|
||||
[currentUser setObject: emails forKey: @"emails"];
|
||||
[currentUser setObject: cn forKey: @"cn"];
|
||||
[currentUser setObject: c_uid forKey: @"c_uid"];
|
||||
|
||||
Reference in new issue
Block a user