mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-06 08:55:08 +00:00
Fix for bug #1328
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
/* LDAPSource.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007-2011 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||
* Copyright (C) 2007-2013 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -125,8 +121,6 @@ andMultipleBookingsField: (NSString *) newMultipleBookingsField;
|
||||
|
||||
- (NGLdapEntry *) lookupGroupEntryByUID: (NSString *) theUID;
|
||||
- (NGLdapEntry *) lookupGroupEntryByEmail: (NSString *) theEmail;
|
||||
- (NGLdapEntry *) lookupGroupEntryByAttribute: (NSString *) theAttribute
|
||||
andValue: (NSString *) theValue;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+33
-34
@@ -1,10 +1,6 @@
|
||||
/* LDAPSource.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007-2012 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||
* Copyright (C) 2007-2013 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -1245,40 +1241,31 @@ static Class NSStringK;
|
||||
return [_dnCache objectForKey: theLogin];
|
||||
}
|
||||
|
||||
- (NGLdapEntry *) lookupGroupEntryByUID: (NSString *) theUID
|
||||
{
|
||||
return [self lookupGroupEntryByAttribute: UIDField
|
||||
andValue: theUID];
|
||||
}
|
||||
|
||||
- (NGLdapEntry *) lookupGroupEntryByEmail: (NSString *) theEmail
|
||||
{
|
||||
#warning We should support MailFieldNames
|
||||
return [self lookupGroupEntryByAttribute: @"mail"
|
||||
andValue: theEmail];
|
||||
}
|
||||
|
||||
// This method should accept multiple attributes
|
||||
- (NGLdapEntry *) lookupGroupEntryByAttribute: (NSString *) theAttribute
|
||||
andValue: (NSString *) theValue
|
||||
- (NGLdapEntry *) _lookupGroupEntryByAttributes: (NSArray *) theAttributes
|
||||
andValue: (NSString *) theValue
|
||||
{
|
||||
EOQualifier *qualifier;
|
||||
NSString *s;
|
||||
NGLdapEntry *ldapEntry;
|
||||
|
||||
if ([theValue length] > 0)
|
||||
NSString *s;
|
||||
|
||||
if ([theValue length] > 0 && [theAttributes count] > 0)
|
||||
{
|
||||
s = [NSString stringWithFormat: @"(%@='%@')",
|
||||
theAttribute, SafeLDAPCriteria(theValue)];
|
||||
if ([theAttributes count] == 1)
|
||||
{
|
||||
s = [NSString stringWithFormat: @"(%@='%@')",
|
||||
[theAttributes lastObject], SafeLDAPCriteria(theValue)];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *fieldFormat;
|
||||
|
||||
fieldFormat = [NSString stringWithFormat: @"(%%@='%@')", SafeLDAPCriteria(theValue)];
|
||||
s = [[theAttributes stringsWithFormat: fieldFormat]
|
||||
componentsJoinedByString: @" OR "];
|
||||
}
|
||||
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: s];
|
||||
|
||||
// We look for additional attributes - the ones related to group
|
||||
// membership
|
||||
// attributes = [NSMutableArray arrayWithArray: [self _searchAttributes]];
|
||||
// [attributes addObject: @"member"];
|
||||
// [attributes addObject: @"uniqueMember"];
|
||||
// [attributes addObject: @"memberUid"];
|
||||
// [attributes addObject: @"memberOf"];
|
||||
ldapEntry = [self _lookupLDAPEntry: qualifier];
|
||||
}
|
||||
else
|
||||
@@ -1287,6 +1274,18 @@ static Class NSStringK;
|
||||
return ldapEntry;
|
||||
}
|
||||
|
||||
- (NGLdapEntry *) lookupGroupEntryByUID: (NSString *) theUID
|
||||
{
|
||||
return [self _lookupGroupEntryByAttributes: [NSArray arrayWithObject: UIDField]
|
||||
andValue: theUID];
|
||||
}
|
||||
|
||||
- (NGLdapEntry *) lookupGroupEntryByEmail: (NSString *) theEmail
|
||||
{
|
||||
return [self _lookupGroupEntryByAttributes: mailFields
|
||||
andValue: theEmail];
|
||||
}
|
||||
|
||||
- (void) setSourceID: (NSString *) newSourceID
|
||||
{
|
||||
ASSIGN (sourceID, newSourceID);
|
||||
|
||||
Reference in New Issue
Block a user