From 446cee7d733379a586a043fb5ec4b15a94975b65 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 18 Mar 2009 15:48:22 +0000 Subject: [PATCH] Monotone-Parent: 408ae95acfcd0bdbf903540439a12eaacb285310 Monotone-Revision: 5c7224f461ae8749b0bd83c9c137e1b826f6000f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-03-18T15:48:22 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 +++++++ SoObjects/SOGo/SOGoUserFolder.m | 38 +++++++-------------------------- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18610def4..7d5f02542 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-03-18 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoUserFolder.m ([SOGoUserFolder + -lookupName:_keyinContext:_ctxacquire:_flag]): no longer invoke + the _accessDeniedPage when accessing the module is forbidden to + the current user. Instead, returns an HTTP exception with code + 404. + 2009-03-17 Ludovic Marcotte * Documentation/SOGo Installation Guide.odt diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index 971dde279..94ce19c9b 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -117,16 +117,17 @@ static NSString *LDAPContactInfoAttribute = nil; - (NSDictionary *) _parseCollectionFilters: (id ) parentNode { - NSEnumerator *children; + id children; NGDOMNode *node; NSMutableDictionary *filter; NSString *componentName; + unsigned int count, max; filter = [NSMutableDictionary dictionaryWithCapacity: 2]; - children = [[parentNode getElementsByTagName: @"prop-match"] - objectEnumerator]; - while ((node = [children nextObject])) + children = [parentNode getElementsByTagName: @"prop-match"]; + for (count = 0; count < max; count++) { + node = [children objectAtIndex: count]; componentName = [[node attribute: @"name"] lowercaseString]; [filter setObject: [node textValue] forKey: componentName]; } @@ -441,33 +442,13 @@ static NSString *LDAPContactInfoAttribute = nil; 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 { id obj; SOGoUser *currentUser; - + /* first check attributes directly bound to the application */ obj = [super lookupName: _key inContext: _ctx acquire: NO]; if (!obj) @@ -477,8 +458,6 @@ static NSString *LDAPContactInfoAttribute = nil; { 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]; @@ -486,15 +465,14 @@ static NSString *LDAPContactInfoAttribute = nil; { 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]; else if ([_key isEqualToString: @"freebusy.ifb"]) obj = [self freeBusyObject:_key inContext: _ctx]; - else + + if (!obj) obj = [NSException exceptionWithHTTPStatus: 404 /* Not Found */]; }