Monotone-Parent: d690ff1fe2dd685ce9e4e5a8773578c039ec1bf4
Monotone-Revision: be3f824ea546882828787185ebfdd086e3742f87 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-04-11T19:17:20 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
5ff3a45095
commit
48f210e151
|
@ -81,7 +81,7 @@
|
|||
sm = [SoSecurityManager sharedSecurityManager];
|
||||
if (![sm validatePermission: SOGoPerm_FreeBusyLookup
|
||||
onObject: calFolder
|
||||
inContext: context]])
|
||||
inContext: context])
|
||||
infos = [calFolder fetchFreeBusyInfosFrom: _startDate
|
||||
to: _endDate];
|
||||
else
|
||||
|
|
|
@ -142,7 +142,7 @@ static NSString *mailTemplateDefaultLanguage = nil;
|
|||
if (![folder isNotNull]) /* no folder was found for given UID */
|
||||
continue;
|
||||
|
||||
task = [folder lookupName:[self nameInContainer] inContext:ctx
|
||||
task = [folder lookupName:[self nameInContainer] inContext: context
|
||||
acquire:NO];
|
||||
if ([task isKindOfClass: [NSException class]])
|
||||
{
|
||||
|
|
|
@ -344,7 +344,6 @@ static NSString *fromInternetSuffixPattern = nil;
|
|||
{
|
||||
NSDictionary *lInfo;
|
||||
NGMimeMessage *message;
|
||||
WOContext *ctx;
|
||||
NSString *fromInternetSuffix;
|
||||
BOOL addSuffix;
|
||||
id body;
|
||||
|
@ -352,12 +351,11 @@ static NSString *fromInternetSuffixPattern = nil;
|
|||
if ((lInfo = [self fetchInfo]) == nil)
|
||||
return nil;
|
||||
|
||||
ctx = [[WOApplication application] context];
|
||||
addSuffix = [ctx isAccessFromIntranet] ? NO : YES;
|
||||
addSuffix = [context isAccessFromIntranet] ? NO : YES;
|
||||
if (addSuffix) {
|
||||
fromInternetSuffix =
|
||||
[fromInternetSuffixPattern stringByReplacingVariablesWithBindings:
|
||||
[ctx request]
|
||||
[context request]
|
||||
stringForUnknownBindings:@""];
|
||||
|
||||
addSuffix = [fromInternetSuffix length] > 0 ? YES : NO;
|
||||
|
|
|
@ -124,16 +124,8 @@ static BOOL useAltNamespace = NO;
|
|||
/* identity */
|
||||
|
||||
- (SOGoMailIdentity *)preferredIdentity {
|
||||
WOContext *ctx;
|
||||
|
||||
if ((ctx = [[WOApplication application] context]) == nil) {
|
||||
[self logWithFormat:@"ERROR(%s): cannot procede without context!",
|
||||
__PRETTY_FUNCTION__];
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [[ctx activeUser] primaryMailIdentityForAccount:
|
||||
[self nameInContainer]];
|
||||
return [[context activeUser] primaryMailIdentityForAccount:
|
||||
[self nameInContainer]];
|
||||
}
|
||||
|
||||
/* hierarchy */
|
||||
|
@ -161,7 +153,7 @@ static BOOL useAltNamespace = NO;
|
|||
NSString *s;
|
||||
NSArray *creds;
|
||||
|
||||
rq = [[(WOApplication *)[WOApplication application] context] request];
|
||||
rq = [context request];
|
||||
|
||||
s = [rq headerForKey:@"x-webobjects-remote-user"];
|
||||
if ([s length] > 0)
|
||||
|
|
|
@ -32,8 +32,7 @@ static NSString *AgenorShareLoginMarker = @".-.";
|
|||
/* detect webmail being accessed from the outside */
|
||||
|
||||
- (BOOL)isInternetRequest {
|
||||
return [[(WOApplication *)[WOApplication application] context]
|
||||
isAccessFromIntranet] ? NO : YES;
|
||||
return ([context isAccessFromIntranet] ? NO : YES);
|
||||
}
|
||||
|
||||
/* listing the available mailboxes */
|
||||
|
@ -41,28 +40,15 @@ static NSString *AgenorShareLoginMarker = @".-.";
|
|||
- (BOOL)isInHomeFolderBranchOfLoggedInAccount:(id)_ctx {
|
||||
id user;
|
||||
|
||||
if (_ctx == nil) _ctx = [[WOApplication application] context];
|
||||
if (_ctx == nil) {
|
||||
[self errorWithFormat:@"Missing context!"];
|
||||
return NO;
|
||||
}
|
||||
|
||||
user = [_ctx activeUser];
|
||||
return [[[self container] nameInContainer] isEqualToString:[user login]];
|
||||
}
|
||||
|
||||
- (NSArray *)toManyRelationshipKeys {
|
||||
WOContext *ctx;
|
||||
id user;
|
||||
id account;
|
||||
NSArray *shares;
|
||||
|
||||
if ((ctx = [[WOApplication application] context]) == nil) {
|
||||
[self logWithFormat:@"ERROR(%s): cannot procede without context!",
|
||||
__PRETTY_FUNCTION__];
|
||||
return nil;
|
||||
}
|
||||
|
||||
/*
|
||||
Note: this is not strictly correct. The accounts being retrieved should be
|
||||
the accounts based on the container object of this folder. Given
|
||||
|
@ -73,10 +59,10 @@ static NSString *AgenorShareLoginMarker = @".-.";
|
|||
functionality which isn't perfect either.
|
||||
=> TODO
|
||||
*/
|
||||
user = [ctx activeUser];
|
||||
user = [context activeUser];
|
||||
|
||||
/* for now: return nothing if the home-folder does not belong to the login */
|
||||
if (![self isInHomeFolderBranchOfLoggedInAccount:ctx]) {
|
||||
if (![self isInHomeFolderBranchOfLoggedInAccount: context]) {
|
||||
[self warnWithFormat:@"User %@ tried to access mail hierarchy of %@",
|
||||
[user login], [[self container] nameInContainer]];
|
||||
return nil;
|
||||
|
@ -97,17 +83,11 @@ static NSString *AgenorShareLoginMarker = @".-.";
|
|||
- (NSArray *)fetchIdentitiesWithOnlyEmitterAccess:(BOOL)_flag {
|
||||
WOContext *ctx;
|
||||
|
||||
if ((ctx = [[WOApplication application] context]) == nil) {
|
||||
[self logWithFormat:@"ERROR(%s): cannot procede without context!",
|
||||
__PRETTY_FUNCTION__];
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ([self isInternetRequest]) { /* only show primary mailbox in Internet */
|
||||
// just return the primary identity
|
||||
id identity;
|
||||
|
||||
identity = [[ctx activeUser] primaryMailIdentity];
|
||||
identity = [[context activeUser] primaryMailIdentity];
|
||||
return [identity isNotNull] ? [NSArray arrayWithObject:identity] : nil;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ static BOOL debugOn = YES;
|
|||
NSString *auth;
|
||||
NSArray *creds;
|
||||
|
||||
rq = [[(WOApplication *)[WOApplication application] context] request];
|
||||
rq = [context request];
|
||||
if ((auth = [rq headerForKey:@"authorization"]) == nil) {
|
||||
/* no basic auth */
|
||||
return nil;
|
||||
|
|
|
@ -92,7 +92,6 @@ static NGLogger *logger = nil;
|
|||
}
|
||||
|
||||
- (void)_setupFolders {
|
||||
WOContext *ctx;
|
||||
NSMutableDictionary *md;
|
||||
NSMutableArray *ma;
|
||||
NSArray *luids;
|
||||
|
@ -103,8 +102,6 @@ static NGLogger *logger = nil;
|
|||
if ((luids = [self uids]) == nil)
|
||||
return;
|
||||
|
||||
ctx = [[WOApplication application] context];
|
||||
|
||||
count = [luids count];
|
||||
ma = [NSMutableArray arrayWithCapacity:count + 1];
|
||||
md = [NSMutableDictionary dictionaryWithCapacity:count];
|
||||
|
@ -114,7 +111,7 @@ static NGLogger *logger = nil;
|
|||
id folder;
|
||||
|
||||
uid = [luids objectAtIndex:i];
|
||||
folder = [self _primaryLookupFolderForUID:uid inContext:ctx];
|
||||
folder = [self _primaryLookupFolderForUID:uid inContext: context];
|
||||
|
||||
if ([folder isNotNull]) {
|
||||
[md setObject:folder forKey:uid];
|
||||
|
|
Loading…
Reference in New Issue