From: znek Date: Thu, 14 Jul 2005 10:50:50 +0000 (+0000) Subject: prepared AgenorUserManager to retrieve autoresponder state X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d61894047a7072a6e8a4c8882d1e0fceccfece2b;p=scalable-opengroupware.org prepared AgenorUserManager to retrieve autoresponder state git-svn-id: http://svn.opengroupware.org/SOGo/trunk@746 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/Main/ChangeLog b/SOGo/Main/ChangeLog index e9066962..a7f320e0 100644 --- a/SOGo/Main/ChangeLog +++ b/SOGo/Main/ChangeLog @@ -1,5 +1,8 @@ 2005-07-14 Marcus Mueller + * 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 diff --git a/SOGo/Main/SOGoUserHomePage.m b/SOGo/Main/SOGoUserHomePage.m index e5e821dd..9d442660 100644 --- a/SOGo/Main/SOGoUserHomePage.m +++ b/SOGo/Main/SOGoUserHomePage.m @@ -37,6 +37,7 @@ @end #include +#include #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 */ diff --git a/SOGo/Main/Version b/SOGo/Main/Version index 708a90e8..e5b894f7 100644 --- a/SOGo/Main/Version +++ b/SOGo/Main/Version @@ -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 diff --git a/SOGo/SoObjects/SOGo/AgenorUserManager.h b/SOGo/SoObjects/SOGo/AgenorUserManager.h index 0e278c73..9b1c4f05 100644 --- a/SOGo/SoObjects/SOGo/AgenorUserManager.h +++ b/SOGo/SoObjects/SOGo/AgenorUserManager.h @@ -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_ */ diff --git a/SOGo/SoObjects/SOGo/AgenorUserManager.m b/SOGo/SoObjects/SOGo/AgenorUserManager.m index 687e7cad..ff049f58 100644 --- a/SOGo/SoObjects/SOGo/AgenorUserManager.m +++ b/SOGo/SoObjects/SOGo/AgenorUserManager.m @@ -39,6 +39,10 @@ - (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 { diff --git a/SOGo/SoObjects/SOGo/ChangeLog b/SOGo/SoObjects/SOGo/ChangeLog index 950d2a6c..2037499e 100644 --- a/SOGo/SoObjects/SOGo/ChangeLog +++ b/SOGo/SoObjects/SOGo/ChangeLog @@ -1,5 +1,10 @@ 2005-07-14 Marcus Mueller + * 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) diff --git a/SOGo/SoObjects/SOGo/Version b/SOGo/SoObjects/SOGo/Version index d4d22dfe..0b3dc209 100644 --- a/SOGo/SoObjects/SOGo/Version +++ b/SOGo/SoObjects/SOGo/Version @@ -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