2009-11-29 05:19:32 +01:00
|
|
|
/* SOGoSystemDefaults.m - this file is part of SOGo
|
|
|
|
*
|
2015-05-14 21:26:18 +02:00
|
|
|
* Copyright (C) 2009-2015 Inverse inc.
|
2012-10-19 16:07:45 +02:00
|
|
|
* Copyright (C) 2012 Jeroen Dekkers <jeroen@dekkers.ch>
|
2009-11-29 05:19:32 +01:00
|
|
|
*
|
|
|
|
* This file is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <dlfcn.h>
|
|
|
|
#import <unistd.h>
|
|
|
|
|
2011-06-24 21:19:50 +02:00
|
|
|
#import <Foundation/NSArray.h>
|
2009-11-29 05:19:32 +01:00
|
|
|
#import <Foundation/NSBundle.h>
|
|
|
|
#import <Foundation/NSFileManager.h>
|
2011-06-24 21:19:50 +02:00
|
|
|
#import <Foundation/NSFileManager.h>
|
2013-02-01 22:26:01 +01:00
|
|
|
#import <Foundation/NSDictionary.h>
|
2009-11-29 05:19:32 +01:00
|
|
|
#import <Foundation/NSUserDefaults.h>
|
|
|
|
|
|
|
|
#import <NGExtensions/NSObject+Logs.h>
|
|
|
|
|
2011-06-24 21:19:50 +02:00
|
|
|
#import "NSArray+Utilities.h"
|
2009-11-29 05:19:32 +01:00
|
|
|
#import "NSDictionary+Utilities.h"
|
|
|
|
#import "SOGoStartupLogger.h"
|
|
|
|
|
|
|
|
#import "SOGoSystemDefaults.h"
|
2010-03-18 13:58:39 +01:00
|
|
|
#import "SOGoConstants.h"
|
2009-11-29 05:19:32 +01:00
|
|
|
|
|
|
|
@implementation SOGoSystemDefaults
|
|
|
|
|
|
|
|
#if defined(LDAP_CONFIG)
|
|
|
|
#import <SOGo/SOGoLDAPUserDefaults.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef void (*NSUserDefaultsInitFunction) ();
|
|
|
|
|
|
|
|
#define DIR_SEP "/"
|
|
|
|
|
|
|
|
static void
|
|
|
|
BootstrapNSUserDefaults ()
|
|
|
|
{
|
|
|
|
char *filename;
|
|
|
|
NSUserDefaultsInitFunction SOGoNSUserDefaultsBootstrap;
|
|
|
|
void *handle;
|
|
|
|
|
|
|
|
filename = SOGO_LIBDIR DIR_SEP "libSOGoNSUserDefaults.so.1";
|
|
|
|
handle = dlopen (filename, RTLD_NOW | RTLD_GLOBAL);
|
|
|
|
if (handle)
|
|
|
|
{
|
|
|
|
SOGoNSUserDefaultsBootstrap = dlsym (handle,
|
2013-01-25 02:35:03 +01:00
|
|
|
"SOGoNSUserDefaultsBootstrap");
|
2009-11-29 05:19:32 +01:00
|
|
|
if (SOGoNSUserDefaultsBootstrap)
|
2013-01-25 02:35:03 +01:00
|
|
|
SOGoNSUserDefaultsBootstrap ();
|
2009-11-29 05:19:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:41:34 +02:00
|
|
|
static void
|
2013-02-01 22:26:01 +01:00
|
|
|
_injectConfigurationFromFile (NSMutableDictionary *defaultsDict,
|
2012-10-23 19:41:34 +02:00
|
|
|
NSString *filename, NSObject *logger)
|
|
|
|
{
|
2012-12-11 15:34:06 +01:00
|
|
|
NSDictionary *newConfig, *fileAttrs;
|
2012-10-23 19:41:34 +02:00
|
|
|
NSFileManager *fm;
|
|
|
|
|
|
|
|
fm = [NSFileManager defaultManager];
|
|
|
|
if ([fm fileExistsAtPath: filename])
|
|
|
|
{
|
2012-12-11 15:34:06 +01:00
|
|
|
fileAttrs = [fm fileAttributesAtPath: filename
|
2013-01-25 04:43:38 +01:00
|
|
|
traverseLink: YES];
|
2012-12-10 20:05:11 +01:00
|
|
|
if (![fileAttrs objectForKey: @"NSFileSize"])
|
|
|
|
{
|
|
|
|
[logger errorWithFormat:
|
2013-01-25 02:35:03 +01:00
|
|
|
@"Can't get file attributes from '%@'",
|
|
|
|
filename];
|
2012-12-10 20:05:11 +01:00
|
|
|
exit(1);
|
2013-01-25 02:35:03 +01:00
|
|
|
}
|
2012-12-10 20:05:11 +01:00
|
|
|
if ([[fileAttrs objectForKey: @"NSFileSize"] intValue] == 0 )
|
2009-11-29 05:19:32 +01:00
|
|
|
{
|
2012-12-10 20:05:11 +01:00
|
|
|
[logger warnWithFormat:
|
|
|
|
@"Empty file: '%@'. Skipping",
|
2012-10-23 19:41:34 +02:00
|
|
|
filename];
|
2012-12-10 20:05:11 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
newConfig = [NSDictionary dictionaryWithContentsOfFile: filename];
|
|
|
|
if (newConfig)
|
2013-02-01 22:26:01 +01:00
|
|
|
[defaultsDict addEntriesFromDictionary: newConfig];
|
2012-12-10 20:05:11 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
[logger errorWithFormat:
|
|
|
|
@"Cannot read configuration from '%@'. Aborting",
|
|
|
|
filename];
|
|
|
|
exit(1);
|
|
|
|
}
|
2009-11-29 05:19:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (void) prepareUserDefaults
|
|
|
|
{
|
2013-01-25 04:43:38 +01:00
|
|
|
/* Load settings from configuration files and
|
|
|
|
* enforce the following order of precedence.
|
|
|
|
* First match wins
|
|
|
|
* 1. Command line arguments
|
|
|
|
* 2. .GNUstepDefaults
|
|
|
|
* 3. /etc/sogo/{debconf,sogo}.conf
|
|
|
|
* 4. SOGoDefaults.plist
|
|
|
|
*
|
|
|
|
* The default standardUserDefaults search list is as follows:
|
|
|
|
* GSPrimaryDomain
|
|
|
|
* NSArgumentDomain (command line arguments)
|
|
|
|
* applicationDomain (sogod)
|
|
|
|
* NSGlobalDomain
|
|
|
|
* GSConfigDomain
|
|
|
|
* (languages)
|
|
|
|
* NSRegistrationDomain
|
2013-02-01 22:26:01 +01:00
|
|
|
*
|
|
|
|
* We'll end up with this search list:
|
|
|
|
* NSArgumentDomain (command line arguments)
|
|
|
|
* sogodRuntimeDomain (config from all config files)
|
|
|
|
* GSPrimaryDomain
|
|
|
|
* NSGlobalDomain
|
|
|
|
* GSConfigDomain
|
|
|
|
* (languages)
|
|
|
|
* NSRegistrationDomain (SOPE loads its defaults in this one)
|
2013-01-25 04:43:38 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
NSDictionary *sogodDomain;
|
2013-02-01 22:26:01 +01:00
|
|
|
NSMutableDictionary *configFromFiles;
|
2009-11-29 05:19:32 +01:00
|
|
|
NSUserDefaults *ud;
|
|
|
|
SOGoStartupLogger *logger;
|
2012-10-23 19:41:34 +02:00
|
|
|
NSBundle *bundle;
|
|
|
|
NSString *confFiles[] = {@"/etc/sogo/debconf.conf",
|
|
|
|
@"/etc/sogo/sogo.conf"};
|
|
|
|
NSString *filename, *redirectURL;
|
|
|
|
NSUInteger count;
|
2009-11-29 05:19:32 +01:00
|
|
|
|
|
|
|
logger = [SOGoStartupLogger sharedLogger];
|
|
|
|
|
2013-02-01 22:26:01 +01:00
|
|
|
/* Load the configuration from the standard user default files */
|
2009-11-29 05:19:32 +01:00
|
|
|
ud = [NSUserDefaults standardUserDefaults];
|
|
|
|
|
2013-02-01 22:26:01 +01:00
|
|
|
/* Populate configFromFiles with default values from SOGoDefaults.plist */
|
|
|
|
configFromFiles = [NSMutableDictionary dictionaryWithCapacity:0];
|
2012-10-23 19:41:34 +02:00
|
|
|
bundle = [NSBundle bundleForClass: self];
|
|
|
|
filename = [bundle pathForResource: @"SOGoDefaults" ofType: @"plist"];
|
|
|
|
if (filename)
|
2013-02-01 22:26:01 +01:00
|
|
|
_injectConfigurationFromFile (configFromFiles, filename, logger);
|
2012-10-23 19:41:34 +02:00
|
|
|
|
2013-02-01 22:26:01 +01:00
|
|
|
/* Fill/Override configFromFiles values with configuration stored
|
2013-01-25 04:43:38 +01:00
|
|
|
* in "/etc" */
|
2012-10-23 19:41:34 +02:00
|
|
|
for (count = 0; count < sizeof(confFiles)/sizeof(confFiles[0]); count++)
|
2013-02-01 22:26:01 +01:00
|
|
|
_injectConfigurationFromFile (configFromFiles, confFiles[count], logger);
|
2012-10-23 19:41:34 +02:00
|
|
|
|
2013-01-25 04:43:38 +01:00
|
|
|
/* This dance is required to let other appplications (sogo-tool) use
|
|
|
|
* options from the sogod domain while preserving the order of precedence
|
|
|
|
* - remove the 'sogod' domain from the user defaults search list
|
2013-02-01 22:26:01 +01:00
|
|
|
* - Load the content of the sogod domain into configFromFiles
|
2013-01-25 04:43:38 +01:00
|
|
|
* Thereby overriding values from the config files loaded above
|
|
|
|
*/
|
|
|
|
[ud removeSuiteNamed: @"sogod"];
|
|
|
|
sogodDomain = [ud persistentDomainForName: @"sogod"];
|
|
|
|
if ([sogodDomain count])
|
2013-02-01 22:26:01 +01:00
|
|
|
[configFromFiles addEntriesFromDictionary: sogodDomain];
|
|
|
|
|
|
|
|
/* Add a volatile domain containing the config to the search list.
|
|
|
|
* The domain is added at the very front of the search list
|
|
|
|
*/
|
|
|
|
[ud setVolatileDomain: configFromFiles
|
|
|
|
forName: @"sogodRuntimeDomain"];
|
|
|
|
[ud addSuiteNamed: @"sogodRuntimeDomain"];
|
|
|
|
|
|
|
|
/* NSArgumentsDomain goes back in front of the search list */
|
|
|
|
[ud addSuiteNamed: @"NSArgumentDomain"];
|
2013-01-25 04:43:38 +01:00
|
|
|
|
2012-10-23 19:41:34 +02:00
|
|
|
/* issue a warning if WOApplicationRedirectURL is used */
|
2009-11-29 05:19:32 +01:00
|
|
|
redirectURL = [ud stringForKey: @"WOApplicationRedirectURL"];
|
|
|
|
if (redirectURL)
|
|
|
|
{
|
|
|
|
[logger warnWithFormat:
|
|
|
|
@"Using obsolete 'WOApplicationRedirectURL' user default."];
|
|
|
|
[logger warnWithFormat:
|
|
|
|
@" Please configure the use of the x-webobjects-XXX headers"
|
|
|
|
@" with your webserver (see sample files)."];
|
|
|
|
if ([redirectURL hasSuffix: @"/"])
|
|
|
|
[ud setObject: [redirectURL substringToIndex: [redirectURL length] - 1]
|
|
|
|
forKey: @"WOApplicationRedirectURL"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
BootstrapNSUserDefaults ();
|
|
|
|
[self prepareUserDefaults];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (SOGoSystemDefaults *) sharedSystemDefaults
|
|
|
|
{
|
|
|
|
static SOGoSystemDefaults *sharedSystemDefaults = nil;
|
|
|
|
NSUserDefaults *ud;
|
|
|
|
|
|
|
|
if (!sharedSystemDefaults)
|
|
|
|
{
|
|
|
|
ud = [NSUserDefaults standardUserDefaults];
|
|
|
|
sharedSystemDefaults = [self defaultsSourceWithSource: ud
|
|
|
|
andParentSource: nil];
|
|
|
|
[sharedSystemDefaults retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
return sharedSystemDefaults;
|
|
|
|
}
|
|
|
|
|
2011-06-24 21:19:50 +02:00
|
|
|
- (id) init
|
|
|
|
{
|
|
|
|
if ((self = [super init]))
|
|
|
|
{
|
|
|
|
loginDomains = nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
|
|
|
[loginDomains release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
- (BOOL) migrate
|
|
|
|
{
|
|
|
|
static NSDictionary *migratedKeys = nil;
|
|
|
|
|
|
|
|
if (!migratedKeys)
|
|
|
|
{
|
|
|
|
migratedKeys = [NSDictionary dictionaryWithObjectsAndKeys:
|
|
|
|
@"SOGoProfileURL", @"AgenorProfileURL",
|
|
|
|
@"SOGoTimeZone", @"SOGoServerTimeZone",
|
|
|
|
nil];
|
|
|
|
[migratedKeys retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
return ([self migrateOldDefaultsWithDictionary: migratedKeys]
|
|
|
|
| [super migrate]);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) domainIds
|
|
|
|
{
|
|
|
|
return [[self dictionaryForKey: @"domains"] allKeys];
|
|
|
|
}
|
|
|
|
|
2011-07-19 18:25:11 +02:00
|
|
|
- (BOOL) enableDomainBasedUID
|
2011-07-16 00:22:11 +02:00
|
|
|
{
|
2015-09-23 15:41:48 +02:00
|
|
|
return [self boolForKey: @"SOGoEnableDomainBasedUID"];
|
2011-07-16 00:22:11 +02:00
|
|
|
}
|
|
|
|
|
2011-06-24 21:19:50 +02:00
|
|
|
- (NSArray *) loginDomains
|
|
|
|
{
|
|
|
|
NSMutableArray *filteredLoginDomains;
|
|
|
|
NSArray *domains;
|
|
|
|
id currentObject;
|
2016-01-06 15:52:15 +01:00
|
|
|
int count;
|
2011-06-24 21:19:50 +02:00
|
|
|
|
|
|
|
if (self->loginDomains == nil)
|
|
|
|
{
|
|
|
|
filteredLoginDomains = [NSMutableArray arrayWithArray: [self stringArrayForKey: @"SOGoLoginDomains"]];
|
|
|
|
domains = [self domainIds];
|
2016-01-06 15:52:15 +01:00
|
|
|
count = [filteredLoginDomains count];
|
|
|
|
while (count > 0)
|
2011-06-24 21:19:50 +02:00
|
|
|
{
|
2016-01-06 15:52:15 +01:00
|
|
|
count--;
|
|
|
|
currentObject = [filteredLoginDomains objectAtIndex: count];
|
2011-06-24 21:19:50 +02:00
|
|
|
if (![domains containsObject: currentObject])
|
|
|
|
{
|
|
|
|
[filteredLoginDomains removeObject: currentObject];
|
|
|
|
[self warnWithFormat: @"SOGoLoginDomains contains an invalid domain : %@", currentObject];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSIGN (self->loginDomains, filteredLoginDomains);
|
|
|
|
}
|
|
|
|
|
|
|
|
return self->loginDomains;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) visibleDomainsForDomain: (NSString *) domain
|
|
|
|
{
|
|
|
|
NSMutableArray *domains;
|
|
|
|
NSArray *definedDomains, *visibleDomains, *currentGroup;
|
|
|
|
NSEnumerator *groups;
|
|
|
|
NSString *currentDomain;
|
|
|
|
|
|
|
|
definedDomains = [self domainIds];
|
|
|
|
visibleDomains = [self arrayForKey: @"SOGoDomainsVisibility"];
|
|
|
|
domains = [NSMutableArray array];
|
|
|
|
groups = [visibleDomains objectEnumerator];
|
|
|
|
while ((currentGroup = (NSArray *)[groups nextObject]))
|
|
|
|
{
|
|
|
|
if ([currentGroup containsObject: domain])
|
|
|
|
[domains addObjectsFromArray: currentGroup];
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:22:11 +02:00
|
|
|
// Remove lookup domain and invalid domains
|
2011-06-24 21:19:50 +02:00
|
|
|
groups = [domains objectEnumerator];
|
|
|
|
while ((currentDomain = [groups nextObject]))
|
|
|
|
{
|
2011-07-16 00:22:11 +02:00
|
|
|
if ([currentDomain isEqualToString: domain] || ![definedDomains containsObject: currentDomain])
|
2011-06-24 21:19:50 +02:00
|
|
|
[domains removeObject: currentDomain];
|
|
|
|
}
|
|
|
|
|
|
|
|
return [domains uniqueObjects];
|
|
|
|
}
|
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
/* System-level only */
|
|
|
|
|
|
|
|
- (BOOL) crashOnSessionCreate
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoCrashOnSessionCreate"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) debugRequests
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoDebugRequests"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) debugLeaks;
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoDebugLeaks"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) vmemLimit
|
|
|
|
{
|
|
|
|
return [self integerForKey: @"SxVMemLimit"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) trustProxyAuthentication;
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoTrustProxyAuthentication"];
|
|
|
|
}
|
|
|
|
|
2013-03-11 14:34:36 +01:00
|
|
|
- (NSString *) encryptionKey;
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoEncryptionKey"];
|
|
|
|
}
|
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
- (BOOL) useRelativeURLs
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"WOUseRelativeURLs"];
|
|
|
|
}
|
|
|
|
|
2014-03-10 15:07:47 +01:00
|
|
|
- (NSString *) sieveFolderEncoding
|
2014-03-05 18:31:27 +01:00
|
|
|
{
|
2014-03-10 15:07:47 +01:00
|
|
|
return [self stringForKey: @"SOGoSieveFolderEncoding"];
|
2014-03-05 18:31:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-09 00:18:12 +01:00
|
|
|
- (BOOL) isWebAccessEnabled
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoWebAccessEnabled"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isCalendarDAVAccessEnabled
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoCalendarDAVAccessEnabled"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isAddressBookDAVAccessEnabled
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoAddressBookDAVAccessEnabled"];
|
|
|
|
}
|
|
|
|
|
2010-08-19 19:27:58 +02:00
|
|
|
- (BOOL) enableEMailAlarms
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoEnableEMailAlarms"];
|
|
|
|
}
|
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
- (NSString *) faviconRelativeURL
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoFaviconRelativeURL"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) zipPath
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoZipPath"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) port
|
|
|
|
{
|
|
|
|
return [self integerForKey: @"WOPort"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) workers
|
|
|
|
{
|
|
|
|
return [self integerForKey: @"WOWorkersCount"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) logFile
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"WOLogFile"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) pidFile
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"WOPidFile"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSTimeInterval) cacheCleanupInterval
|
|
|
|
{
|
|
|
|
return [self floatForKey: @"SOGoCacheCleanupInterval"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) memcachedHost
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoMemcachedHost"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) uixDebugEnabled
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoUIxDebugEnabled"];
|
|
|
|
}
|
|
|
|
|
2015-05-14 21:26:18 +02:00
|
|
|
- (BOOL) easDebugEnabled
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoEASDebugEnabled"];
|
|
|
|
}
|
|
|
|
|
2011-03-30 17:21:27 +02:00
|
|
|
- (NSString *) pageTitle
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoPageTitle"];
|
|
|
|
}
|
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
- (NSArray *) supportedLanguages
|
|
|
|
{
|
2012-10-26 03:58:34 +02:00
|
|
|
static NSArray *supportedLanguages = nil;
|
|
|
|
|
|
|
|
if (!supportedLanguages)
|
|
|
|
{
|
|
|
|
supportedLanguages = [self stringArrayForKey: @"SOGoSupportedLanguages"];
|
|
|
|
[supportedLanguages retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
return supportedLanguages;
|
2009-11-29 05:19:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) userCanChangePassword
|
|
|
|
{
|
2010-03-18 13:58:39 +01:00
|
|
|
return [self boolForKey: SOGoPasswordChangeEnabled];
|
2009-11-29 05:19:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) uixAdditionalPreferences
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoUIxAdditionalPreferences"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) loginSuffix
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoLoginSuffix"];
|
|
|
|
}
|
|
|
|
|
2010-01-28 22:42:03 +01:00
|
|
|
- (NSString *) authenticationType
|
|
|
|
{
|
|
|
|
return [[self stringForKey: @"SOGoAuthenticationType"] lowercaseString];
|
|
|
|
}
|
|
|
|
|
2010-06-10 23:32:23 +02:00
|
|
|
- (NSString *) davAuthenticationType
|
|
|
|
{
|
|
|
|
return [[self stringForKey: @"SOGoDAVAuthenticationType"] lowercaseString];
|
|
|
|
}
|
|
|
|
|
2010-01-28 22:42:03 +01:00
|
|
|
- (NSString *) CASServiceURL
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoCASServiceURL"];
|
|
|
|
}
|
|
|
|
|
2010-06-10 20:40:57 +02:00
|
|
|
- (BOOL) CASLogoutEnabled
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoCASLogoutEnabled"];
|
|
|
|
}
|
|
|
|
|
2012-11-02 20:30:13 +01:00
|
|
|
/* SAML2 support */
|
|
|
|
- (NSString *) SAML2PrivateKeyLocation
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoSAML2PrivateKeyLocation"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) SAML2CertificateLocation;
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoSAML2CertificateLocation"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) SAML2IdpMetadataLocation
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoSAML2IdpMetadataLocation"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) SAML2IdpPublicKeyLocation
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoSAML2IdpPublicKeyLocation"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) SAML2IdpCertificateLocation
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoSAML2IdpCertificateLocation"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) SAML2LogoutEnabled
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoSAML2LogoutEnabled"];
|
|
|
|
}
|
|
|
|
|
2014-12-04 23:59:17 +01:00
|
|
|
- (NSString *) SAML2LogoutURL
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoSAML2LogoutURL"];
|
|
|
|
}
|
|
|
|
|
2014-11-26 19:00:47 +01:00
|
|
|
- (NSString *) SAML2LoginAttribute
|
|
|
|
{
|
|
|
|
return [self stringForKey: @"SOGoSAML2LoginAttribute"];
|
|
|
|
}
|
|
|
|
|
2010-06-01 20:49:01 +02:00
|
|
|
- (BOOL) enablePublicAccess
|
|
|
|
{
|
|
|
|
return [self boolForKey: @"SOGoEnablePublicAccess"];
|
|
|
|
}
|
|
|
|
|
2013-06-11 17:21:58 +02:00
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
2013-06-11 15:41:17 +02:00
|
|
|
- (int) maximumFailedLoginCount
|
|
|
|
{
|
|
|
|
return [self integerForKey: @"SOGoMaximumFailedLoginCount"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) maximumFailedLoginInterval
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoMaximumFailedLoginInterval"];
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
v = 10;
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) failedLoginBlockInterval
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoFailedLoginBlockInterval"];
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
v = 300;
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
2016-12-28 16:18:10 +01:00
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
- (int) maximumMessageSizeLimit
|
|
|
|
{
|
|
|
|
return [self integerForKey: @"SOGoMaximumMessageSizeLimit"];
|
|
|
|
}
|
|
|
|
|
2013-06-11 17:21:58 +02:00
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
- (int) maximumMessageSubmissionCount
|
|
|
|
{
|
|
|
|
return [self integerForKey: @"SOGoMaximumMessageSubmissionCount"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) maximumRecipientCount
|
|
|
|
{
|
|
|
|
return [self integerForKey: @"SOGoMaximumRecipientCount"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) maximumSubmissionInterval
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoMaximumSubmissionInterval"];
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
v = 30;
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) messageSubmissionBlockInterval
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoMessageSubmissionBlockInterval"];
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
v = 300;
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
2016-03-18 16:03:45 +01:00
|
|
|
//
|
|
|
|
// SOGo rate-limiting
|
|
|
|
//
|
|
|
|
- (int) maximumRequestCount
|
|
|
|
{
|
|
|
|
return [self integerForKey: @"SOGoMaximumRequestCount"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) maximumRequestInterval
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoMaximumRequestInterval"];
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
v = 30;
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) requestBlockInterval
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoRequestBlockInterval"];
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
v = 300;
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// SOGo EAS settings
|
|
|
|
//
|
2014-02-11 02:16:43 +01:00
|
|
|
- (int) maximumPingInterval
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoMaximumPingInterval"];
|
|
|
|
|
|
|
|
if (!v)
|
2014-10-29 19:56:03 +01:00
|
|
|
v = 10;
|
2014-02-11 02:16:43 +01:00
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) maximumSyncInterval
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoMaximumSyncInterval"];
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
v = 30;
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) internalSyncInterval
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoInternalSyncInterval"];
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
v = 10;
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
2014-04-10 02:12:19 +02:00
|
|
|
- (int) maximumSyncWindowSize
|
|
|
|
{
|
|
|
|
return [self integerForKey: @"SOGoMaximumSyncWindowSize"];
|
|
|
|
}
|
|
|
|
|
2014-12-22 17:50:51 +01:00
|
|
|
- (int) maximumSyncResponseSize
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
|
|
|
v = [self integerForKey: @"SOGoMaximumSyncResponseSize"];
|
|
|
|
|
|
|
|
if (v > 0)
|
|
|
|
v = v * 1024;
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
2009-11-29 05:19:32 +01:00
|
|
|
@end
|