Monotone-Parent: 2946be96e24ef28355163488376def0341ef650f

Monotone-Revision: 57efdfff0ce1c589f0aa7c70ace7f877ffa5d52c

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-08-26T17:40:02
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-08-26 17:40:02 +00:00
parent 335d43c92c
commit 8f9d53726f
11 changed files with 128 additions and 6 deletions
+37 -6
View File
@@ -27,6 +27,7 @@
#import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/SoClassSecurityInfo.h>
#import <NGObjWeb/SoSecurityManager.h>
#import <NGObjWeb/WOApplication.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WORequest.h>
#import <NGObjWeb/WOResponse.h>
@@ -44,6 +45,8 @@
#import <Contacts/SOGoContactFolders.h>
#import <Mailer/SOGoMailAccounts.h>
#import <SOGoUI/UIxComponent.h>
#import "NSArray+Utilities.h"
#import "NSDictionary+Utilities.h"
#import "LDAPUserManager.h"
@@ -442,6 +445,26 @@
return [$(@"SOGoFreeBusyObject") objectWithName: _key inContainer: self];
}
- (WOResponse *) _moduleAccessDeniedPage
{
WOResponse *response;
UIxComponent *page;
NSString *content;
response = [context response];
[response setStatus: 403];
[response setHeader: @"text/html; charset=utf8"
forKey: @"content-type"];
page = [[WOApplication application] pageWithName: @"UIxModuleAccessDenied"
inContext: context];
// [page appendToResponse: response
// inContext: context];
content = [[page generateResponse] contentAsString];
[response appendContentString: content];
return response;
}
- (id) lookupName: (NSString *) _key
inContext: (WOContext *) _ctx
acquire: (BOOL) _flag
@@ -454,14 +477,22 @@
if (!obj)
{
currentUser = [_ctx activeUser];
if ([_key isEqualToString: @"Calendar"]
&& [currentUser canAccessModule: _key])
obj = [self privateCalendars: @"Calendar" inContext: _ctx];
if ([_key isEqualToString: @"Calendar"])
{
if ([currentUser canAccessModule: _key])
obj = [self privateCalendars: @"Calendar" inContext: _ctx];
else
obj = [self _moduleAccessDeniedPage];
}
else if ([_key isEqualToString: @"Contacts"])
obj = [self privateContacts: _key inContext: _ctx];
else if ([_key isEqualToString: @"Mail"]
&& [currentUser canAccessModule: _key])
obj = [self mailAccountsFolder: _key inContext: _ctx];
else if ([_key isEqualToString: @"Mail"])
{
if ([currentUser canAccessModule: _key])
obj = [self mailAccountsFolder: _key inContext: _ctx];
else
obj = [self _moduleAccessDeniedPage];
}
else if ([_key isEqualToString: @"Preferences"])
obj = [$(@"SOGoPreferencesFolder") objectWithName: _key
inContainer: self];