#include "SOGoUser+Mail.h"
#include "common.h"
#include <NGObjWeb/SoObject+SoDAV.h>
-#include <SOGo/WOContext+Agenor.h>
@implementation SOGoMailAccounts
static NSString *AgenorShareLoginMarker = @".-.";
-/* detect webmail being accessed from the outside */
-
-- (BOOL)isInternetRequest {
- return ([context isAccessFromIntranet] ? NO : YES);
-}
-
/* listing the available mailboxes */
- (BOOL) isInHomeFolderBranchOfLoggedInAccount: (NSString *) userLogin
account = [user primaryIMAP4AccountString];
if ([account isNotNull]) account = [NSArray arrayWithObject:account];
- if ([self isInternetRequest]) /* only show primary mailbox in Internet */
- return account;
-
shares = [user valueForKey:@"additionalIMAP4AccountStrings"];
return ([shares count] == 0)
? account
}
if ([self isValidMailAccountName:_key]) {
- /* forbid shares for requests coming from the Internet */
BOOL isSharedKey;
isSharedKey = [_key rangeOfString:AgenorShareLoginMarker].length > 0;
- if ([self isInternetRequest]) {
- if (isSharedKey) {
- return [NSException exceptionWithHTTPStatus:403 /* Forbidden */
- reason:
- @"Access to shares forbidden from the Internet"];
- }
- }
-
return isSharedKey
? [self sharedMailAccountWithName:_key inContext:_ctx]
: [self mailAccountWithName:_key inContext:_ctx];