]> err.no Git - scalable-opengroupware.org/blobdiff - SoObjects/Mailer/SOGoMailAccounts.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1101 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / SoObjects / Mailer / SOGoMailAccounts.m
index d33c58c9702c352f98ae68e2c7f1fd5de9e5930a..bb3ac3ba4687fc2a987b89eef1cc4f9e0fc738c2 100644 (file)
 #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
@@ -71,27 +64,19 @@ static NSString *AgenorShareLoginMarker  = @".-.";
   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
     : [account arrayByAddingObjectsFromArray:shares];
 }
 
-- (NSArray *)fetchIdentitiesWithOnlyEmitterAccess:(BOOL)_flag {
-  WOContext *ctx;
-  
-  if ([self isInternetRequest]) { /* only show primary mailbox in Internet */
-    // just return the primary identity
-    id identity;
-    
-    identity = [[context activeUser] primaryMailIdentity];
-    return [identity isNotNull] ? [NSArray arrayWithObject:identity] : nil;
-  }
-  
-  return [[ctx activeUser] fetchAllMailIdentitiesWithOnlyEmitterAccess:_flag];
+- (NSArray *) fetchIdentitiesWithOnlyEmitterAccess: (BOOL) _flag
+{
+  NSString *accountString;
+
+  accountString = [[context activeUser] primaryIMAP4AccountString];
+
+  return [NSArray arrayWithObject: accountString];
 }
 
 - (NSArray *)fetchAllIdentities {
@@ -161,19 +146,10 @@ static NSString *AgenorShareLoginMarker  = @".-.";
   }
   
   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];
@@ -185,8 +161,22 @@ static NSString *AgenorShareLoginMarker  = @".-.";
 
 /* WebDAV */
 
-- (BOOL)davIsCollection {
+- (BOOL) davIsCollection
+{
   return YES;
 }
 
+- (NSString *) davContentType
+{
+  return @"httpd/unix-directory";
+}
+
+/* acls */
+
+- (NSArray *) aclsForUser: (NSString *) uid
+{
+  return nil;
+}
+
+
 @end /* SOGoMailAccounts */