]> err.no Git - scalable-opengroupware.org/commitdiff
prepared AgenorUserManager to retrieve autoresponder state
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 14 Jul 2005 10:50:50 +0000 (10:50 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 14 Jul 2005 10:50:50 +0000 (10:50 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@746 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/Main/ChangeLog
SOGo/Main/SOGoUserHomePage.m
SOGo/Main/Version
SOGo/SoObjects/SOGo/AgenorUserManager.h
SOGo/SoObjects/SOGo/AgenorUserManager.m
SOGo/SoObjects/SOGo/ChangeLog
SOGo/SoObjects/SOGo/Version

index e90669624b41d17265a637a9a4ed1ebf5dbc5381..a7f320e002b3a0af75ae44206c6f120c22a6a39c 100644 (file)
@@ -1,5 +1,8 @@
 2005-07-14  Marcus Mueller  <znek@mulle-kybernetik.com>
 
+       * SOGoUserHomePage.m: vacation message state is now properly being
+         retrieved from AgenorUserManager (v0.9.32)
+
        * v0.9.31
 
        * SOGoUserHomePage.[m, wox]: added internet access lock
index e5e821dd51e6f1c43d749d073f501ceb165f7828..9d4426607c31a660afb4f32d1b51a9d2c845ae47 100644 (file)
@@ -37,6 +37,7 @@
 @end
 
 #include <SOGo/AgenorUserManager.h>
+#include <SOGo/WOContext+Agenor.h>
 #include "SOGoUser.h"
 #include "common.h"
 
@@ -189,11 +190,21 @@ static NSArray *internetAccessStates = nil;
 }
 
 - (BOOL)isVacationMessageEnabledForInternet {
-  return NO;
+  AgenorUserManager *um;
+  NSString          *uid;
+
+  um  = [AgenorUserManager sharedUserManager];
+  uid = [[[self context] activeUser] login];
+  return [um isInternetAutoresponderEnabledForUser:uid];
 }
 
 - (BOOL)isVacationMessageEnabledForIntranet {
-  return YES;
+  AgenorUserManager *um;
+  NSString          *uid;
+  
+  um  = [AgenorUserManager sharedUserManager];
+  uid = [[[self context] activeUser] login];
+  return [um isIntranetAutoresponderEnabledForUser:uid];
 }
 
 /* actions */
index 708a90e8bf44180f8fa9b8ceef044b188c1c6f3b..e5b894f727ee8be889c6ae693183eec14b066636 100644 (file)
@@ -1,6 +1,7 @@
 # Version file
 
-SUBMINOR_VERSION:=31
+SUBMINOR_VERSION:=32
 
+# v0.9.32 requires libSOGo         v0.9.57
 # v0.9.24 requires libWEExtensions v4.5.67
 # v0.9.16 requires libNGExtensions v4.5.136
index 0e278c73f297488e826d83113ced61f9e1df4180..9b1c4f0505176c3345f92998bd38f7208532aec4 100644 (file)
@@ -43,6 +43,8 @@
   SOGoLRUCache *shareStoreCache;
   SOGoLRUCache *shareEMailCache;
   SOGoLRUCache *changeInternetAccessCache;
+  SOGoLRUCache *internetAutoresponderFlagCache;
+  SOGoLRUCache *intranetAutoresponderFlagCache;
 }
 
 + (id)sharedUserManager;
@@ -73,6 +75,9 @@
 
 - (BOOL)isUserAllowedToChangeSOGoInternetAccess:(NSString *)_uid;
 
+- (BOOL)isInternetAutoresponderEnabledForUser:(NSString *)_uid;
+- (BOOL)isIntranetAutoresponderEnabledForUser:(NSString *)_uid;
+
 @end
 
 #endif /* __AgenorUserManager_H_ */
index 687e7cad4c972e3a7f7d9b51627b9cfb8c48db79..ff049f58075e05bf7dd70fb53b8f075f2a4b8d1b 100644 (file)
 - (NSString *)_cachedUIDForEmail:(NSString *)_email;
 
 - (BOOL)primaryIsUserAllowedToChangeSOGoInternetAccess:(NSString *)_uid;
+
+- (BOOL)primaryIsInternetAutoresponderEnabledForUser:(NSString *)_uid;
+- (BOOL)primaryIsIntranetAutoresponderEnabledForUser:(NSString *)_uid;
+- (id)primaryGetMailAutoresponderAttribute:(NSString *)_uid;
 @end
 
 // TODO: add a timer to flush LRU caches every some hours
@@ -56,6 +60,7 @@ static NSString *shareLDAPClass               = @"mineqMelBoite";
 static NSString *shareLoginSeparator          = @".-.";
 static NSString *mailEmissionAttrName         = @"mineqMelmailEmission";
 static NSString *changeInternetAccessAttrName = @"mineqOgoAccesInternet";
+static NSString *mailAutoresponderAttrName    = @"mineqMelReponse"; /* sic! */
 static NSURL    *AgenorProfileURL             = nil;
 
 static NSArray *fromEMailAttrs = nil;
@@ -119,18 +124,24 @@ static NSArray *fromEMailAttrs = nil;
     self->shareEMailCache = [[SOGoLRUCache alloc] initWithCacheSize:10000];
     self->changeInternetAccessCache =
       [[SOGoLRUCache alloc] initWithCacheSize:10000];
+    self->internetAutoresponderFlagCache =
+      [[SOGoLRUCache alloc] initWithCacheSize:10000];
+    self->intranetAutoresponderFlagCache =
+      [[SOGoLRUCache alloc] initWithCacheSize:10000];
   }
   return self;
 }
 
 - (void)dealloc {
-  [self->serverCache               release];
-  [self->cnCache                   release];
-  [self->uidCache                  release];
-  [self->emailCache                release];
-  [self->shareStoreCache           release];
-  [self->shareEMailCache           release];
-  [self->changeInternetAccessCache release];
+  [self->serverCache     release];
+  [self->cnCache         release];
+  [self->uidCache        release];
+  [self->emailCache      release];
+  [self->shareStoreCache release];
+  [self->shareEMailCache release];
+  [self->changeInternetAccessCache      release];
+  [self->internetAutoresponderFlagCache release];
+  [self->intranetAutoresponderFlagCache release];
   [super dealloc];
 }
 
@@ -903,6 +914,79 @@ static NSArray *fromEMailAttrs = nil;
   return [value boolValue];
 }
 
+- (BOOL)isInternetAutoresponderEnabledForUser:(NSString *)_uid {
+  NSNumber *bv;
+
+  bv = [self->internetAutoresponderFlagCache objectForKey:_uid];
+  if (!bv) {
+    BOOL value;
+    
+    value = [self primaryIsInternetAutoresponderEnabledForUser:_uid];
+    bv    = [NSNumber numberWithBool:value];
+    [self->internetAutoresponderFlagCache addObject:bv forKey:_uid];
+  }
+  return [bv boolValue];
+}
+
+- (BOOL)primaryIsInternetAutoresponderEnabledForUser:(NSString *)_uid {
+  return NO;
+}
+
+- (BOOL)isIntranetAutoresponderEnabledForUser:(NSString *)_uid {
+  NSNumber *bv;
+  
+  bv = [self->intranetAutoresponderFlagCache objectForKey:_uid];
+  if (!bv) {
+    BOOL value;
+    
+    value = [self primaryIsIntranetAutoresponderEnabledForUser:_uid];
+    bv    = [NSNumber numberWithBool:value];
+    [self->intranetAutoresponderFlagCache addObject:bv forKey:_uid];
+  }
+  return [bv boolValue];
+}
+
+- (BOOL)primaryIsIntranetAutoresponderEnabledForUser:(NSString *)_uid {
+  return NO;
+}
+
+- (id)primaryGetMailAutoresponderAttribute:(NSString *)_uid {
+  static NSArray   *attrs = nil;
+  NGLdapConnection *conn;
+  EOQualifier      *q;
+  NSEnumerator     *resultEnum;
+  NGLdapEntry      *entry;
+  NGLdapAttribute  *attr;
+  
+  if (attrs == nil)
+    attrs = [[NSArray alloc] initWithObjects:mailAutoresponderAttrName, nil];
+
+  q = [EOQualifier qualifierWithQualifierFormat:@"uid = %@", _uid];
+  
+  conn       = [self ldapConnection];
+  resultEnum = [conn deepSearchAtBaseDN:ldapBaseDN
+                     qualifier:q
+                     attributes:attrs];
+  entry = [resultEnum nextObject];
+  if (entry == nil) {
+    if(debugOn) {
+      [self logWithFormat:@"%s Didn't find LDAP entry for uid '%@'!",
+        __PRETTY_FUNCTION__,
+        _uid];
+    }
+    return nil;
+  }
+  attr = [entry attributeWithName:mailAutoresponderAttrName];
+  if(attr == nil) {
+    return nil; /* nothing we can do about it */
+  }
+  /* ZNeK: TODO
+   * ... we need to have the proper specs before we can do anything about it
+   */
+  [self warnWithFormat:@"%s TODO", __PRETTY_FUNCTION__];
+  return nil;
+}
+
 /* debugging */
 
 - (BOOL)isDebuggingEnabled {
index 950d2a6c9929b42f91abc4a883427d62d88fedb5..2037499e782a184ea51de45736adce28cc3f34d8 100644 (file)
@@ -1,5 +1,10 @@
 2005-07-14  Marcus Mueller  <znek@mulle-kybernetik.com>
 
+       * AgenorUserManager.[hm]: added accessors and cache for the
+         'mineqMelReponse' flag. Please note that the implementation isn't
+         fully fleshed out because the technical specification isn't correct.
+         (v0.9.57)
+
        * AgenorUserManager.[hm]: added accessors and cache for the
          'mineqOgoAccesInternet' flag (v0.9.56)
 
index d4d22dfe5fe9446aee51731d2d39a549d9cde4b0..0b3dc209e7e9954ebeed92c4e6b16220bf93a513 100644 (file)
@@ -1,6 +1,6 @@
 # version file
 
-SUBMINOR_VERSION:=55
+SUBMINOR_VERSION:=57
 
 # v0.9.50 requires libGDLContentStore v4.5.30
 # v0.9.34 requires libGDLContentStore v4.5.26