- (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
static NSString *shareLoginSeparator = @".-.";
static NSString *mailEmissionAttrName = @"mineqMelmailEmission";
static NSString *changeInternetAccessAttrName = @"mineqOgoAccesInternet";
+static NSString *mailAutoresponderAttrName = @"mineqMelReponse"; /* sic! */
static NSURL *AgenorProfileURL = nil;
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];
}
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 {