Added isDomainDefined
To check whether a domain is supported by our defined sources
This commit is contained in:
parent
9d3f3c619d
commit
bf4a581d0f
|
@ -41,6 +41,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#import "SOGoSystemDefaults.h"
|
||||
#import "SOGoUserManager.h"
|
||||
|
||||
@implementation SOGoSession
|
||||
|
||||
|
@ -262,7 +263,7 @@
|
|||
// The domain is probably appended to the username;
|
||||
// make sure it is defined as a domain in the configuration.
|
||||
*theDomain = [*theLogin substringFromIndex: (r.location + r.length)];
|
||||
if (![[sd domainIds] containsObject: *theDomain])
|
||||
if (![[SOGoUserManager sharedUserManager] isDomainDefined: *theDomain])
|
||||
*theDomain = nil;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@
|
|||
// The domain is probably appended to the username;
|
||||
// make sure it is defined as a domain in the configuration.
|
||||
domain = [newLogin substringFromIndex: (r.location + r.length)];
|
||||
if ([[sd domainIds] containsObject: domain] &&
|
||||
if ([[SOGoUserManager sharedUserManager] isDomainDefined: domain] &&
|
||||
![sd enableDomainBasedUID])
|
||||
newLogin = [newLogin substringToIndex: r.location];
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
- (NSArray *) sourceIDsInDomain: (NSString *) domain;
|
||||
- (NSArray *) authenticationSourceIDsInDomain: (NSString *) domain;
|
||||
- (NSArray *) addressBookSourceIDsInDomain: (NSString *) domain;
|
||||
- (BOOL) isDomainDefined: (NSString *) domain;
|
||||
|
||||
- (NSObject <SOGoSource> *) sourceWithID: (NSString *) sourceID;
|
||||
- (NSDictionary *) metadataForSourceID: (NSString *) sourceID;
|
||||
|
|
|
@ -305,6 +305,35 @@ static Class NSNullK;
|
|||
return sourceIDs;
|
||||
}
|
||||
|
||||
- (BOOL) isDomainDefined: (NSString *) domain
|
||||
{
|
||||
NSEnumerator *allIDs;
|
||||
NSArray *ids;
|
||||
NSString *currentID, *sourceDomain;
|
||||
SOGoSystemDefaults *sd;
|
||||
|
||||
if (!domain) return NO;
|
||||
|
||||
ids = [_sources allKeys];
|
||||
if ([ids containsObject: domain])
|
||||
// FIXME check SOGoMailDomain?
|
||||
// Now source id is being considered as the domain
|
||||
return YES;
|
||||
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
if ([sd enableDomainBasedUID])
|
||||
{
|
||||
allIDs = [ids objectEnumerator];
|
||||
while ((currentID = [allIDs nextObject]))
|
||||
{
|
||||
sourceDomain = [[_sources objectForKey: currentID] domain];
|
||||
if (!sourceDomain) // source that can identify any domain
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
- (NSString *) displayNameForSourceWithID: (NSString *) sourceID
|
||||
{
|
||||
NSDictionary *metadata;
|
||||
|
@ -932,7 +961,7 @@ static Class NSNullK;
|
|||
// The domain is probably appended to the username;
|
||||
// make sure it is a defined domain in the configuration.
|
||||
domain = [uid substringFromIndex: (r.location + r.length)];
|
||||
if ([[sd domainIds] containsObject: domain])
|
||||
if ([self isDomainDefined: domain])
|
||||
username = [uid substringToIndex: r.location];
|
||||
else
|
||||
domain = nil;
|
||||
|
|
Loading…
Reference in a new issue