mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-23 04:15:26 +00:00
Add domain to lookupContactEntry
This commit is contained in:
committed by
Carlos Pérez-Aradros Herce
parent
48832a4878
commit
7d49674d9d
@@ -164,9 +164,10 @@
|
||||
ldifEntry = [childRecords objectForKey: objectName];
|
||||
if (!ldifEntry)
|
||||
{
|
||||
ldifEntry = [source lookupContactEntry: objectName];
|
||||
if (ldifEntry)
|
||||
[childRecords setObject: ldifEntry forKey: objectName];
|
||||
ldifEntry = [source lookupContactEntry: objectName
|
||||
inDomain: [[context activeUser] domain]];
|
||||
if (ldifEntry)
|
||||
[childRecords setObject: ldifEntry forKey: objectName];
|
||||
else if ([self isValidContentName: objectName])
|
||||
{
|
||||
url = [[[lookupContext request] uri] urlWithoutParameters];
|
||||
@@ -324,10 +325,14 @@
|
||||
NSDictionary *record;
|
||||
|
||||
if (aName && [aName length] > 0)
|
||||
record = [self _flattenedRecord: [source lookupContactEntry: aName]];
|
||||
{
|
||||
record = [source lookupContactEntry: aName
|
||||
inDomain: [[context activeUser] domain]];
|
||||
record = [self _flattenedRecord: record];
|
||||
}
|
||||
else
|
||||
record = nil;
|
||||
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
@@ -562,7 +567,7 @@
|
||||
toResponse: (WOResponse *) response
|
||||
{
|
||||
NSObject <DOMElement> *element;
|
||||
NSString *url, *baseURL, *cname;
|
||||
NSString *url, *baseURL, *cname, *domain;
|
||||
NSString **propertiesArray;
|
||||
NSMutableString *buffer;
|
||||
NSDictionary *object;
|
||||
@@ -579,13 +584,13 @@
|
||||
|
||||
max = [refs length];
|
||||
buffer = [NSMutableString stringWithCapacity: max*512];
|
||||
|
||||
domain = [[context activeUser] domain];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
element = [refs objectAtIndex: count];
|
||||
url = [[[element firstChild] nodeValue] stringByUnescapingURL];
|
||||
cname = [self _deduceObjectNameFromURL: url fromBaseURL: baseURL];
|
||||
object = [source lookupContactEntry: cname];
|
||||
object = [source lookupContactEntry: cname inDomain: domain];
|
||||
if (object)
|
||||
[self appendObject: object
|
||||
properties: propertiesArray
|
||||
|
||||
@@ -1242,6 +1242,7 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
|
||||
}
|
||||
|
||||
- (NSDictionary *) lookupContactEntry: (NSString *) theID
|
||||
inDomain: (NSString *) domain
|
||||
{
|
||||
NGLdapEntry *ldapEntry;
|
||||
EOQualifier *qualifier;
|
||||
|
||||
@@ -56,7 +56,8 @@
|
||||
newPassword: (NSString *) newPassword
|
||||
perr: (SOGoPasswordPolicyError *) perr;
|
||||
|
||||
- (NSDictionary *) lookupContactEntry: (NSString *) theID;
|
||||
- (NSDictionary *) lookupContactEntry: (NSString *) theID
|
||||
inDomain: (NSString *) domain;
|
||||
- (NSDictionary *) lookupContactEntryWithUIDorEmail: (NSString *) entryID
|
||||
inDomain: (NSString *) domain;
|
||||
|
||||
|
||||
@@ -1047,7 +1047,7 @@ static Class NSNullK;
|
||||
while ((sourceID = [sources nextObject]))
|
||||
{
|
||||
currentSource = [_sources objectForKey: sourceID];
|
||||
contact = [currentSource lookupContactEntry: uid];
|
||||
contact = [currentSource lookupContactEntry: uid inDomain: domain];
|
||||
if (contact)
|
||||
[contacts addObject: contact];
|
||||
}
|
||||
|
||||
@@ -618,8 +618,9 @@
|
||||
|
||||
|
||||
- (NSDictionary *) lookupContactEntry: (NSString *) theID
|
||||
inDomain: (NSString *) domain
|
||||
{
|
||||
return [self _lookupContactEntry: theID considerEmail: NO inDomain: nil];
|
||||
return [self _lookupContactEntry: theID considerEmail: NO inDomain: domain];
|
||||
}
|
||||
|
||||
- (NSDictionary *) lookupContactEntryWithUIDorEmail: (NSString *) entryID
|
||||
|
||||
@@ -363,6 +363,7 @@
|
||||
}
|
||||
|
||||
- (BOOL) extractUserLDIFRecord: (NSString *) uid
|
||||
inDomain: (NSString *) domain
|
||||
intoRecord: (NSMutableDictionary *) userRecord
|
||||
{
|
||||
NSEnumerator *ldapSources;
|
||||
@@ -375,11 +376,11 @@
|
||||
lm = [SOGoUserManager sharedUserManager];
|
||||
|
||||
done = NO;
|
||||
ldapSources = [[lm authenticationSourceIDsInDomain: nil] objectEnumerator];
|
||||
ldapSources = [[lm authenticationSourceIDsInDomain: domain] objectEnumerator];
|
||||
while (!done && (sourceID = [ldapSources nextObject]))
|
||||
{
|
||||
currentSource = [lm sourceWithID: sourceID];
|
||||
userEntry = [currentSource lookupContactEntry: uid];
|
||||
userEntry = [currentSource lookupContactEntry: uid inDomain: domain];
|
||||
if (userEntry)
|
||||
{
|
||||
[userRecord setObject: [userEntry ldifRecordAsString]
|
||||
@@ -411,25 +412,26 @@
|
||||
|
||||
- (BOOL) exportUser: (NSDictionary *) theUser
|
||||
{
|
||||
NSString *exportPath, *gcsUID, *ldapUID;
|
||||
NSString *exportPath, *gcsUID, *ldapUID, *domain;
|
||||
NSMutableDictionary *userRecord;
|
||||
SOGoSystemDefaults *sd;
|
||||
|
||||
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
userRecord = [NSMutableDictionary dictionary];
|
||||
|
||||
ldapUID = [theUser objectForKey: @"c_uid"];
|
||||
exportPath = [directory stringByAppendingPathComponent: ldapUID];
|
||||
|
||||
domain = [theUser objectForKey: @"c_domain"];
|
||||
gcsUID = [theUser objectForKey: @"c_uid"];
|
||||
|
||||
if ([sd enableDomainBasedUID] && [gcsUID rangeOfString: @"@"].location == NSNotFound)
|
||||
gcsUID = [NSString stringWithFormat: @"%@@%@", gcsUID, [theUser objectForKey: @"c_domain"]];
|
||||
|
||||
|
||||
|
||||
return ([self extractUserFolders: gcsUID
|
||||
intoRecord: userRecord]
|
||||
&& [self extractUserLDIFRecord: ldapUID
|
||||
inDomain: domain
|
||||
intoRecord: userRecord]
|
||||
&& [self extractUserPreferences: gcsUID
|
||||
intoRecord: userRecord]
|
||||
|
||||
Reference in New Issue
Block a user