mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-12 18:33:18 +00:00
Monotone-Parent: 2fdf0ead0781ef2362dd389811d5db44ca4cc84a
Monotone-Revision: c91eef7edcfd08d414664c25a590b6268a7e58e2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-11-29T04:19:32 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
+18
-27
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
|
||||
#import <NGObjWeb/WOApplication.h>
|
||||
#import <NGObjWeb/WOContext.h>
|
||||
@@ -33,13 +32,13 @@
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import <SoObjects/SOGo/SOGoWebAuthenticator.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoDomainDefaults.h>
|
||||
#import <SOGo/SOGoSystemDefaults.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoWebAuthenticator.h>
|
||||
|
||||
#import "SOGoRootPage.h"
|
||||
|
||||
static NSArray *supportedLanguages = nil;
|
||||
|
||||
@interface SOGoRootPage (crashAdditions)
|
||||
|
||||
- (void) segfault;
|
||||
@@ -48,12 +47,6 @@ static NSArray *supportedLanguages = nil;
|
||||
|
||||
@implementation SOGoRootPage
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (!supportedLanguages)
|
||||
supportedLanguages = [NSArray arrayWithObjects: @"Czech", @"Welsh", @"English", @"Spanish", @"French", @"German", @"Italian", @"Hungarian", @"Dutch", @"BrazilianPortuguese", @"Russian", @"Swedish", nil];
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (NSString *) connectURL
|
||||
@@ -68,9 +61,10 @@ static NSArray *supportedLanguages = nil;
|
||||
WORequest *request;
|
||||
WOCookie *authCookie;
|
||||
SOGoWebAuthenticator *auth;
|
||||
SOGoUser *user;
|
||||
SOGoUserDefaults *ud;
|
||||
NSString *cookieValue, *cookieString;
|
||||
NSString *userName, *password, *language;
|
||||
NSArray *supportedLanguages;
|
||||
|
||||
auth = [[WOApplication application]
|
||||
authenticatorInContext: context];
|
||||
@@ -93,12 +87,14 @@ static NSArray *supportedLanguages = nil;
|
||||
[authCookie setIsSecure: YES]; */
|
||||
[response addCookie: authCookie];
|
||||
|
||||
supportedLanguages = [[SOGoSystemDefaults sharedSystemDefaults]
|
||||
supportedLanguages];
|
||||
if (language && [supportedLanguages containsObject: language])
|
||||
{
|
||||
user = [SOGoUser userWithLogin: userName roles: nil];
|
||||
[[user userDefaults] setObject: language forKey: @"Language"];
|
||||
[[user userDefaults] synchronize];
|
||||
[user invalidateLanguage];
|
||||
ud = [[SOGoUser userWithLogin: userName roles: nil]
|
||||
userDefaults];
|
||||
[ud setLanguage: language];
|
||||
[ud synchronize];
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -160,11 +156,7 @@ static NSArray *supportedLanguages = nil;
|
||||
|
||||
- (NSString *) loginSuffix
|
||||
{
|
||||
NSUserDefaults *ud;
|
||||
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
return [ud stringForKey: @"SOGoLoginSuffix"];
|
||||
return [[SOGoSystemDefaults sharedSystemDefaults] loginSuffix];
|
||||
}
|
||||
|
||||
- (BOOL) hasLoginSuffix
|
||||
@@ -184,13 +176,13 @@ static NSArray *supportedLanguages = nil;
|
||||
|
||||
- (NSArray *) languages
|
||||
{
|
||||
return supportedLanguages;
|
||||
return [[SOGoSystemDefaults sharedSystemDefaults] supportedLanguages];
|
||||
}
|
||||
|
||||
- (NSString *) language
|
||||
{
|
||||
return [SOGoUser language];
|
||||
}
|
||||
// - (NSString *) language
|
||||
// {
|
||||
// return [SOGoUser language];
|
||||
// }
|
||||
|
||||
- (NSString *) languageText
|
||||
{
|
||||
@@ -213,5 +205,4 @@ static NSArray *supportedLanguages = nil;
|
||||
return aString;
|
||||
}
|
||||
|
||||
|
||||
@end /* SOGoRootPage */
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/WOCookie.h>
|
||||
@@ -36,74 +35,43 @@
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import <Appointments/SOGoFreeBusyObject.h>
|
||||
#import <SoObjects/SOGo/SOGoUserManager.h>
|
||||
#import <SoObjects/SOGo/SOGoWebAuthenticator.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SoObjects/SOGo/SOGoUserFolder.h>
|
||||
#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
#import <SOGo/SOGoWebAuthenticator.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
#import <SOGo/SOGoUserFolder.h>
|
||||
#import <SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SOGo/NSDictionary+Utilities.h>
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
|
||||
#define intervalSeconds 900 /* 15 minutes */
|
||||
|
||||
static NSString *defaultModule = nil;
|
||||
static NSString *LDAPContactInfoAttribute = nil;
|
||||
|
||||
@interface SOGoUserHomePage : UIxComponent
|
||||
|
||||
@end
|
||||
|
||||
@implementation SOGoUserHomePage
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSUserDefaults *ud;
|
||||
|
||||
if (!defaultModule)
|
||||
{
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
defaultModule = [ud stringForKey: @"SOGoUIxDefaultModule"];
|
||||
if (defaultModule)
|
||||
{
|
||||
if (!([defaultModule isEqualToString: @"Calendar"]
|
||||
|| [defaultModule isEqualToString: @"Contacts"]
|
||||
|| [defaultModule isEqualToString: @"Mail"]))
|
||||
{
|
||||
[self logWithFormat: @"default module '%@' not accepted (must be"
|
||||
@"'Calendar', 'Contacts' or 'Mail')", defaultModule];
|
||||
defaultModule = @"Calendar";
|
||||
}
|
||||
}
|
||||
else
|
||||
defaultModule = @"Calendar";
|
||||
[self logWithFormat: @"default module set to '%@'", defaultModule];
|
||||
[defaultModule retain];
|
||||
|
||||
LDAPContactInfoAttribute = [ud stringForKey: @"SOGoLDAPContactInfoAttribute"];
|
||||
[LDAPContactInfoAttribute retain];
|
||||
}
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) defaultAction
|
||||
{
|
||||
SOGoUserFolder *co;
|
||||
NSUserDefaults *ud;
|
||||
NSString *userDefinedModule;
|
||||
NSString *loginModule;
|
||||
SOGoUserDefaults *ud;
|
||||
NSURL *moduleURL;
|
||||
|
||||
ud = [[context activeUser] userDefaults];
|
||||
userDefinedModule = [ud stringForKey: @"SOGoUIxDefaultModule"];
|
||||
if (userDefinedModule)
|
||||
loginModule = [ud loginModule];
|
||||
if (!([loginModule isEqualToString: @"Calendar"]
|
||||
|| [loginModule isEqualToString: @"Contacts"]
|
||||
|| [loginModule isEqualToString: @"Mail"]))
|
||||
{
|
||||
if ([userDefinedModule isEqualToString: @"Last"])
|
||||
userDefinedModule = [ud stringForKey: @"SOGoUIxLastModule"];
|
||||
[self errorWithFormat: @"login module '%@' not accepted (must be"
|
||||
@"'Calendar', 'Contacts' or 'Mail')", loginModule];
|
||||
loginModule = @"Calendar";
|
||||
}
|
||||
if (!userDefinedModule)
|
||||
userDefinedModule = defaultModule;
|
||||
|
||||
co = [self clientObject];
|
||||
moduleURL = [NSURL URLWithString: userDefinedModule
|
||||
moduleURL = [NSURL URLWithString: loginModule
|
||||
relativeToURL: [co soURL]];
|
||||
|
||||
return [self redirectToLocation: [moduleURL absoluteString]];
|
||||
@@ -219,7 +187,7 @@ static NSString *LDAPContactInfoAttribute = nil;
|
||||
|
||||
co = [self clientObject];
|
||||
user = [context activeUser];
|
||||
uTZ = [user timeZone];
|
||||
uTZ = [[user userDefaults] timeZone];
|
||||
|
||||
queryDay = [self queryParameterForKey: @"sday"];
|
||||
if ([queryDay length])
|
||||
@@ -338,13 +306,8 @@ static NSString *LDAPContactInfoAttribute = nil;
|
||||
// We do NOT return the current authenticated user.
|
||||
if (![uid isEqualToString: login])
|
||||
{
|
||||
if ([LDAPContactInfoAttribute length])
|
||||
{
|
||||
contactInfo = [contact objectForKey: [LDAPContactInfoAttribute lowercaseString]];
|
||||
if (!contactInfo)
|
||||
contactInfo = @"";
|
||||
}
|
||||
else
|
||||
contactInfo = [contact objectForKey: @"c_info"];
|
||||
if (!contactInfo)
|
||||
contactInfo = @"";
|
||||
[responseString appendFormat: @"%@:%@:%@:%@\n", uid,
|
||||
[contact objectForKey: @"cn"],
|
||||
@@ -359,7 +322,7 @@ static NSString *LDAPContactInfoAttribute = nil;
|
||||
|
||||
- (id <WOActionResults>) usersSearchAction
|
||||
{
|
||||
NSString *contact;
|
||||
NSString *contact, *domain;
|
||||
id <WOActionResults> result;
|
||||
SOGoUserManager *um;
|
||||
|
||||
@@ -367,6 +330,7 @@ static NSString *LDAPContactInfoAttribute = nil;
|
||||
contact = [self queryParameterForKey: @"search"];
|
||||
if ([contact length])
|
||||
{
|
||||
domain = [[context activeUser] domain];
|
||||
result
|
||||
= [self _usersResponseForResults: [um fetchUsersMatching: contact]];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user