mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-19 02:08:11 +00:00
See ChangeLog
Monotone-Parent: 216cfb18d3e04f9ead5aaae0aa501e44f20b18df Monotone-Revision: 04df0eebf5080524a4b02c414640106afe5e4ca3 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2008-12-23T22:39:56 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
7c64a77651
commit
fb9eb09c95
3 files changed
+80
-28
No files matched your search
@@ -6,6 +6,9 @@
|
|||||||
This is useful when verifying the freebusy of
|
This is useful when verifying the freebusy of
|
||||||
meeting participants as we must not strip the
|
meeting participants as we must not strip the
|
||||||
c_partstates/c_partmails fields.
|
c_partstates/c_partmails fields.
|
||||||
|
* SoObjects/SOGo/SOGoObject.{h,m}
|
||||||
|
We now permit two parameters during the user-list
|
||||||
|
REPORT in order to avoid LDAP lookups.
|
||||||
|
|
||||||
2008-12-23 Francis Lachapelle <flachapelle@inverse.ca>
|
2008-12-23 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,8 @@ SEL SOGoSelectorForPropertySetter (NSString *property);
|
|||||||
- (SOGoWebDAVValue *) davCurrentUserPrivilegeSet;
|
- (SOGoWebDAVValue *) davCurrentUserPrivilegeSet;
|
||||||
|
|
||||||
/* inverse dav extensions for acls */
|
/* inverse dav extensions for acls */
|
||||||
- (NSString *) davRecordForUser: (NSString *) user;
|
- (NSString *) davRecordForUser: (NSString *) user
|
||||||
|
parameters: (NSArray *) params;
|
||||||
|
|
||||||
/* description */
|
/* description */
|
||||||
|
|
||||||
|
|||||||
+75
-27
@@ -1353,34 +1353,52 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||||||
|
|
||||||
/* dav acls */
|
/* dav acls */
|
||||||
- (NSString *) davRecordForUser: (NSString *) user
|
- (NSString *) davRecordForUser: (NSString *) user
|
||||||
|
parameters: (NSArray *) params
|
||||||
{
|
{
|
||||||
NSMutableString *userRecord;
|
NSMutableString *userRecord;
|
||||||
SOGoUser *sogoUser;
|
SOGoUser *sogoUser;
|
||||||
NSString *cn, *email;
|
|
||||||
|
|
||||||
userRecord = [NSMutableString string];
|
userRecord = [NSMutableString string];
|
||||||
|
|
||||||
[userRecord appendFormat: @"<id>%@</id>",
|
[userRecord appendFormat: @"<id>%@</id>",
|
||||||
[user stringByEscapingXMLString]];
|
[user stringByEscapingXMLString]];
|
||||||
sogoUser = [SOGoUser userWithLogin: user roles: nil];
|
sogoUser = [SOGoUser userWithLogin: user roles: nil];
|
||||||
cn = [sogoUser cn];
|
|
||||||
if (!cn)
|
if (![params containsObject: @"nocn"])
|
||||||
cn = user;
|
{
|
||||||
[userRecord appendFormat: @"<displayName>%@</displayName>",
|
NSString *cn;
|
||||||
[cn stringByEscapingXMLString]];
|
|
||||||
email = [[sogoUser allEmails] objectAtIndex: 0];
|
cn = [sogoUser cn];
|
||||||
if (email)
|
if (!cn)
|
||||||
[userRecord appendFormat: @"<email>%@</email>",
|
cn = user;
|
||||||
[email stringByEscapingXMLString]];
|
[userRecord appendFormat: @"<displayName>%@</displayName>",
|
||||||
|
[cn stringByEscapingXMLString]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (![params containsObject: @"noemail"])
|
||||||
|
{
|
||||||
|
NSString *email;
|
||||||
|
|
||||||
|
email = [[sogoUser allEmails] objectAtIndex: 0];
|
||||||
|
if (email)
|
||||||
|
[userRecord appendFormat: @"<email>%@</email>",
|
||||||
|
[email stringByEscapingXMLString]];
|
||||||
|
}
|
||||||
|
|
||||||
return userRecord;
|
return userRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) _davAclUserListQuery
|
- (NSString *) _davAclUserListQuery: (NSString *) theParameters
|
||||||
{
|
{
|
||||||
NSMutableString *userList;
|
NSMutableString *userList;
|
||||||
NSString *defaultUserID, *currentUserID;
|
NSString *defaultUserID, *currentUserID;
|
||||||
NSEnumerator *users;
|
NSEnumerator *users;
|
||||||
|
NSArray *params;
|
||||||
|
|
||||||
|
if (theParameters && [theParameters length])
|
||||||
|
params = [[theParameters lowercaseString] componentsSeparatedByString: @","];
|
||||||
|
else
|
||||||
|
params = [NSArray array];
|
||||||
|
|
||||||
userList = [NSMutableString string];
|
userList = [NSMutableString string];
|
||||||
|
|
||||||
@@ -1390,9 +1408,14 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||||||
[defaultUserID stringByEscapingXMLString]];
|
[defaultUserID stringByEscapingXMLString]];
|
||||||
users = [[self aclUsers] objectEnumerator];
|
users = [[self aclUsers] objectEnumerator];
|
||||||
while ((currentUserID = [users nextObject]))
|
while ((currentUserID = [users nextObject]))
|
||||||
if (![currentUserID isEqualToString: defaultUserID])
|
{
|
||||||
[userList appendFormat: @"<user>%@</user>",
|
if (![currentUserID isEqualToString: defaultUserID])
|
||||||
[self davRecordForUser: currentUserID]];
|
{
|
||||||
|
[userList appendFormat: @"<user>%@</user>",
|
||||||
|
[self davRecordForUser: currentUserID
|
||||||
|
parameters: params]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
@@ -1441,8 +1464,30 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||||||
{
|
{
|
||||||
node = [childNodes objectAtIndex: 0];
|
node = [childNodes objectAtIndex: 0];
|
||||||
nodeName = [node localName];
|
nodeName = [node localName];
|
||||||
|
|
||||||
|
//
|
||||||
|
// We support parameters during the user-list REPORT.
|
||||||
|
// We do that in order to avoid looking up from the LDAP
|
||||||
|
// the CN and the EMAIL address of the users that are
|
||||||
|
// returned in the REPORT's response. That can be slow if
|
||||||
|
// the LDAP server used for authentication is slow and this
|
||||||
|
// information might not be necessary for scripting purposes.
|
||||||
|
//
|
||||||
|
// The following parameters are supported:
|
||||||
|
//
|
||||||
|
// nocn - avoid returning the CN
|
||||||
|
// noemail - avoid returning the EMAIL address
|
||||||
|
//
|
||||||
|
// Both can be specified using:
|
||||||
|
//
|
||||||
|
// params=nocn,noemail
|
||||||
|
//
|
||||||
if ([nodeName isEqualToString: @"user-list"])
|
if ([nodeName isEqualToString: @"user-list"])
|
||||||
result = [self _davAclUserListQuery];
|
{
|
||||||
|
result = [self _davAclUserListQuery: [[[node attributes]
|
||||||
|
namedItem: @"params"]
|
||||||
|
nodeValue]];
|
||||||
|
}
|
||||||
else if ([nodeName isEqualToString: @"roles"])
|
else if ([nodeName isEqualToString: @"roles"])
|
||||||
{
|
{
|
||||||
attrs = [node attributes];
|
attrs = [node attributes];
|
||||||
@@ -1471,10 +1516,11 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||||||
|
|
||||||
if ([user length])
|
if ([user length])
|
||||||
allUsers = [NSArray arrayWithObject: user];
|
allUsers = [NSArray arrayWithObject: user];
|
||||||
else {
|
else
|
||||||
userAttr = [attrs namedItem: @"users"];
|
{
|
||||||
allUsers = [[userAttr nodeValue] componentsSeparatedByString: @","];
|
userAttr = [attrs namedItem: @"users"];
|
||||||
}
|
allUsers = [[userAttr nodeValue] componentsSeparatedByString: @","];
|
||||||
|
}
|
||||||
|
|
||||||
allRoles = [self _davGetRolesFromRequest: node];
|
allRoles = [self _davGetRolesFromRequest: node];
|
||||||
for (i = 0; i < [allUsers count]; i++)
|
for (i = 0; i < [allUsers count]; i++)
|
||||||
@@ -1515,10 +1561,11 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||||||
{
|
{
|
||||||
if ([self addUserInAcls: [allUsers objectAtIndex: i]])
|
if ([self addUserInAcls: [allUsers objectAtIndex: i]])
|
||||||
result = @"";
|
result = @"";
|
||||||
else {
|
else
|
||||||
result = nil;
|
{
|
||||||
break;
|
result = nil;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@@ -1543,10 +1590,11 @@ SEL SOGoSelectorForPropertySetter (NSString *property)
|
|||||||
{
|
{
|
||||||
if ([self removeUserFromAcls: [allUsers objectAtIndex: i]])
|
if ([self removeUserFromAcls: [allUsers objectAtIndex: i]])
|
||||||
result = @"";
|
result = @"";
|
||||||
else {
|
else
|
||||||
result = nil;
|
{
|
||||||
break;
|
result = nil;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user