From 85b450a669f568d3d0870abf19b5d25c1ad0c0d4 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 14:33:10 +0000 Subject: [PATCH 01/13] reindentation Monotone-Parent: 4520bccbe080f6685e84dc4ecd3ae2c5d9741940 Monotone-Revision: e7e44b2de3f556e55bfeb9b485ea6d66a7f93772 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T14:33:10 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoGCSFolder.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 74639d389..3f8388008 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -739,9 +739,7 @@ static NSArray *childRecordFields = nil; NSDictionary *record; WORequest *request; - obj = [super lookupName: key - inContext: localContext - acquire: acquire]; + obj = [super lookupName: key inContext: localContext acquire: acquire]; if (!obj) { record = [childRecords objectForKey: key]; From ba2271f7aa98e43d19b37633b6e27be59aef1417 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 14:48:45 +0000 Subject: [PATCH 02/13] Monotone-Parent: e7e44b2de3f556e55bfeb9b485ea6d66a7f93772 Monotone-Revision: 661c78a6b95a6fc152c41fa5888b92e92c73e92f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T14:48:45 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoObject.h | 4 ++++ SoObjects/SOGo/SOGoObject.m | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/SoObjects/SOGo/SOGoObject.h b/SoObjects/SOGo/SOGoObject.h index 2daaa8abb..44e30bfa4 100644 --- a/SoObjects/SOGo/SOGoObject.h +++ b/SoObjects/SOGo/SOGoObject.h @@ -98,6 +98,10 @@ - (void) setOwner: (NSString *) newOwner; - (NSString *) ownerInContext: (id) _ctx; +/* a helper that determines whether access rights can be ignored on + an object */ +- (BOOL) ignoreRights; + /* looking up shared objects */ - (SOGoUserFolder *) lookupUserFolder; diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index da6547c84..f48aadd32 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -229,6 +229,25 @@ return owner; } +- (BOOL) ignoreRights +{ + SOGoUser *currentUser; + NSString *login; + BOOL ignoreRights; + + if (activeUserIsOwner) + ignoreRights = YES; + else + { + currentUser = [context activeUser]; + login = [currentUser login]; + ignoreRights = ([login isEqualToString: [self ownerInContext: context]] + || [currentUser isSuperUser]); + } + + return ignoreRights; +} + - (BOOL) isInPublicZone { if (!isInPublicZone) From ddf66a8d107bae2ce521574d3e9d5e60ec700567 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 14:49:29 +0000 Subject: [PATCH 03/13] Monotone-Parent: 661c78a6b95a6fc152c41fa5888b92e92c73e92f Monotone-Revision: 4fcee5b7d94bbc45b4fc732c402cbfa7b3009735 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T14:49:29 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index b16794b59..42fcfcb90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-07-15 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoObject.m (-ignoreRights): new utility method + that determines whether the current object must check access + rights on subobjects. + 2010-07-14 Wolfgang Sourdeau * SoObjects/SOGo/SOGoGCSFolder.m (-aclSQLListingFilter): return an From 97f72faf38825ea6fa06a1948031a666106b87dc Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 14:54:03 +0000 Subject: [PATCH 04/13] Monotone-Parent: 4fcee5b7d94bbc45b4fc732c402cbfa7b3009735 Monotone-Revision: d486d5e829cf0bc377649b3e2d2ecfcc08afb8e8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T14:54:03 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 18 ++++++++ .../Appointments/SOGoAppointmentFolders.m | 16 +++++++- SoObjects/SOGo/SOGoParentFolder.m | 41 ++++++++++--------- Tests/Integration/test-davacl.py | 4 +- 4 files changed, 57 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42fcfcb90..6a4899045 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 2010-07-15 Wolfgang Sourdeau + * Tests/Integration/test-davacl.py + (DAVCalendarPublicAclTest.testCollectionAccessNormalUser): print + the amount of received hrefs. + + * SoObjects/Appointments/SOGoAppointmentFolders.m + (-folderObjectKeys): we now check the "AccessObject" + right on the returned folders to determine whether their ICS or + XML version should be accessible. + + * SoObjects/SOGo/SOGoParentFolder.m + (_fetchPersonalFolders:withChannel:): we no longer check access + rights from here as this method is too low level and prevent other + mechanisms from working properly. + (-lookupName:inContext:acquire:): we now check the "AccessObject" + right from here before returning the found object. We also make + use of the new "ignoreRights" method (see below) to that end. + (-toManyRelationShipKeys): same as lookupName... above. + * SoObjects/SOGo/SOGoObject.m (-ignoreRights): new utility method that determines whether the current object must check access rights on subobjects. diff --git a/SoObjects/Appointments/SOGoAppointmentFolders.m b/SoObjects/Appointments/SOGoAppointmentFolders.m index 13a7b5b8f..3cfba791b 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolders.m +++ b/SoObjects/Appointments/SOGoAppointmentFolders.m @@ -29,6 +29,7 @@ #import #import #import +#import #import #import @@ -63,8 +64,16 @@ @end +static SoSecurityManager *sm = nil; + @implementation SOGoAppointmentFolders ++ (void) initialize +{ + if (!sm) + sm = [SoSecurityManager sharedSecurityManager]; +} + - (id) init { if ((self = [super init])) @@ -166,9 +175,11 @@ SOGoAppointmentFolder *folder; NSString *folderObjectKey; int count, max; + BOOL ignoreRights; if (!folderObjectKeys) { + ignoreRights = [self ignoreRights]; folders = [self subFolders]; max = [folders count]; folderObjectKeys = [[NSMutableArray alloc] initWithCapacity: max]; @@ -176,7 +187,10 @@ { folder = [folders objectAtIndex: count]; if ([folder isMemberOfClass: [SOGoAppointmentFolder class]] - && ![folder isSubscription]) + && ![folder isSubscription] + && (ignoreRights || ![sm validatePermission: SOGoPerm_AccessObject + onObject: folder + inContext: context])) { folderObjectKey = [NSString stringWithFormat: @"%@.ics", [folder nameInContainer]]; diff --git a/SoObjects/SOGo/SOGoParentFolder.m b/SoObjects/SOGo/SOGoParentFolder.m index 2066ba3fe..e9ceb93aa 100644 --- a/SoObjects/SOGo/SOGoParentFolder.m +++ b/SoObjects/SOGo/SOGoParentFolder.m @@ -175,26 +175,19 @@ static SoSecurityManager *sm = nil; { NSArray *attrs; NSDictionary *row; - BOOL hasPersonal, ignoreRights; SOGoGCSFolder *folder; NSString *key, *login; NSException *error; SOGoUser *currentUser; - SoSecurityManager *securityManager; if (!subFolderClass) subFolderClass = [[self class] subFolderClass]; - hasPersonal = NO; error = [fc evaluateExpressionX: sql]; if (!error) { currentUser = [context activeUser]; login = [currentUser login]; - ignoreRights = (activeUserIsOwner || [login isEqualToString: owner] - || [currentUser isSuperUser]); - if (!ignoreRights) - securityManager = [SoSecurityManager sharedSecurityManager]; attrs = [fc describeResults: NO]; while ((row = [fc fetchAttributes: attrs withZone: NULL])) @@ -203,19 +196,13 @@ static SoSecurityManager *sm = nil; if ([key isKindOfClass: [NSString class]]) { folder = [subFolderClass objectWithName: key inContainer: self]; - hasPersonal = (hasPersonal - || [key isEqualToString: @"personal"]); [folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, key]]; - if (ignoreRights - || ![securityManager validatePermission: SOGoPerm_AccessObject - onObject: folder - inContext: context]) - [subFolders setObject: folder forKey: key]; + [subFolders setObject: folder forKey: key]; } } - if (ignoreRights && !hasPersonal) + if (![subFolders objectForKey: @"personal"]) [self _createPersonalFolder]; } @@ -413,8 +400,15 @@ static SoSecurityManager *sm = nil; obj = [NSException exceptionWithHTTPStatus: 503]; } else - obj = [subFolders objectForKey: name]; - + { + obj = [subFolders objectForKey: name]; + if (obj && ![self ignoreRights] + && [sm validatePermission: SOGoPerm_AccessObject + onObject: obj + inContext: context]) + obj = nil; + } + if (!obj) { // Lookup in subscribed folders @@ -475,7 +469,7 @@ static SoSecurityManager *sm = nil; #warning check error here error = [self initSubFolders]; - + subs = [subFolders allValues]; count = [subs count]; for (i = 0; !rc && i < count; i++) @@ -492,11 +486,20 @@ static SoSecurityManager *sm = nil; NSEnumerator *sortedSubFolders; NSMutableArray *keys; SOGoGCSFolder *currentFolder; + BOOL ignoreRights; + + ignoreRights = [self ignoreRights]; keys = [NSMutableArray array]; sortedSubFolders = [[self subFolders] objectEnumerator]; while ((currentFolder = [sortedSubFolders nextObject])) - [keys addObject: [currentFolder nameInContainer]]; + { + if (ignoreRights + || ![sm validatePermission: SOGoPerm_AccessObject + onObject: currentFolder + inContext: context]) + [keys addObject: [currentFolder nameInContainer]]; + } return keys; } diff --git a/Tests/Integration/test-davacl.py b/Tests/Integration/test-davacl.py index 5455929d6..87e47a7d3 100755 --- a/Tests/Integration/test-davacl.py +++ b/Tests/Integration/test-davacl.py @@ -983,12 +983,12 @@ class DAVCalendarPublicAclTest(unittest.TestCase): self.subscriber_client.execute(propfind) hrefs = propfind.response["document"] \ .findall("{DAV:}response/{DAV:}href") + self.assertEquals(len(hrefs), 1, - "expected only one href in response") + "expected 1 href in response instead of %d" % len(hrefs)) self.assertEquals(hrefs[0].text, parentColl, "the href must be the 'Calendar' parent coll.") - acl_utility = utilities.TestCalendarACLUtility(self, self.client, self.createdRsrc) From 106dfe4dbbad15d37d9a37d18c4e33f17e28e16f Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 15 Jul 2010 15:03:35 +0000 Subject: [PATCH 05/13] Added sql-update-1.2.2_to_1.3.0-mysql.sh and modified the spec file and the debian file to include it Monotone-Parent: d486d5e829cf0bc377649b3e2d2ecfcc08afb8e8 Monotone-Revision: 3bf253d3d887017200751e451da4fd1a31cc57ce Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2010-07-15T15:03:35 Monotone-Branch: ca.inverse.sogo --- Scripts/sql-update-1.2.2_to_1.3.0-mysql.sh | 45 ++++++++++++++++++++++ debian/sogo.docs | 1 + sogo.spec | 2 +- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100755 Scripts/sql-update-1.2.2_to_1.3.0-mysql.sh diff --git a/Scripts/sql-update-1.2.2_to_1.3.0-mysql.sh b/Scripts/sql-update-1.2.2_to_1.3.0-mysql.sh new file mode 100755 index 000000000..4dbecf54a --- /dev/null +++ b/Scripts/sql-update-1.2.2_to_1.3.0-mysql.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# this script only works with MySQL + +defaultusername=$USER +defaulthostname=localhost +defaultdatabase=$USER +indextable=sogo_folder_info + +read -p "Username ($defaultusername): " username +read -p "Hostname ($defaulthostname): " hostname +read -p "Database ($defaultdatabase): " database + +if [ -z "$username" ] +then + username=$defaultusername +fi + +if [ -z "$hostname" ] +then + hostname=$defaulthostname +fi + +if [ -z "$database" ] +then + database=$defaultdatabase + fi + + sqlscript="" + +function addField() { + oldIFS="$IFS" + IFS=" " + part="`echo -e \"ALTER TABLE $table ADD COLUMN c_category VARCHAR(255);\\n\"`"; + sqlscript="$sqlscript$part" + IFS="$oldIFS" +} + +tables=`mysql -p -N -B -u $username -h $hostname $database -e "select SUBSTRING_INDEX(c_quick_location, '/', -1) from $indextable where c_folder_type = 'Appointment';"` + +for table in $tables; +do + addField +done +echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database > /dev/null diff --git a/debian/sogo.docs b/debian/sogo.docs index 6641930b8..a272e2d3b 100644 --- a/debian/sogo.docs +++ b/debian/sogo.docs @@ -2,3 +2,4 @@ NEWS README TODO Scripts/sql-update-1.2.2_to_1.3.0.sh +Scripts/sql-update-1.2.2_to_1.3.0-mysql.sh diff --git a/sogo.spec b/sogo.spec index 4dc50837d..09c64e6b1 100644 --- a/sogo.spec +++ b/sogo.spec @@ -188,7 +188,7 @@ rm -fr ${RPM_BUILD_ROOT} %config %{_sysconfdir}/httpd/conf.d/SOGo.conf %config %{_sysconfdir}/sysconfig/sogo -%doc ChangeLog README NEWS Scripts/sql-update-20070724.sh Scripts/sql-update-20070822.sh Scripts/sql-update-20080303.sh Scripts/sql-update-101_to_102.sh Scripts/sql-update-1.2.2_to_1.3.0.sh +%doc ChangeLog README NEWS Scripts/sql-update-20070724.sh Scripts/sql-update-20070822.sh Scripts/sql-update-20080303.sh Scripts/sql-update-101_to_102.sh Scripts/sql-update-1.2.2_to_1.3.0.sh sql-update-1.2.2_to_1.3.0-mysql.sh %files -n sogo-tool %{prefix}/Tools/Admin/sogo-tool From 1211ec78a1bcc6d28ad2d019e510b0425fe871dd Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 16:40:26 +0000 Subject: [PATCH 06/13] Monotone-Parent: d486d5e829cf0bc377649b3e2d2ecfcc08afb8e8 Monotone-Revision: eb91760e130971e6a1b43251bf762b23a408ab34 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T16:40:26 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ UI/WebServerResources/UIxAppointmentEditor.js | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a4899045..2f419ec4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-07-15 Wolfgang Sourdeau + * UI/WebServerResources/UIxAppointmentEditor.js + (onComposeToAllAttendees): take the status image DIV into account + when detecting the user fullnames. + * Tests/Integration/test-davacl.py (DAVCalendarPublicAclTest.testCollectionAccessNormalUser): print the amount of received hrefs. diff --git a/UI/WebServerResources/UIxAppointmentEditor.js b/UI/WebServerResources/UIxAppointmentEditor.js index b1700d83b..1dddfe991 100644 --- a/UI/WebServerResources/UIxAppointmentEditor.js +++ b/UI/WebServerResources/UIxAppointmentEditor.js @@ -115,8 +115,15 @@ function onComposeToAllAttendees() var attendees = $$("DIV#attendeesMenu LI.attendee"); var addresses = new Array(); attendees.each(function(item) { - var address = item.firstChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">"; - addresses.push(address); + var textChild = null; + var childNodes = item.childNodes; + for (var i = 0; !textChild && i < childNodes.length; i++) { + if (childNodes[i].nodeType == 3) { + textChild = childNodes[i]; + var address = textChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">"; + addresses.push(address); + } + } }); if (window.opener) window.opener.openMailTo(addresses.join(",")); From bcab00c58d5bdf81ec3970a60765955b47ebe0f5 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 16:59:35 +0000 Subject: [PATCH 07/13] reindentation Monotone-Parent: eb91760e130971e6a1b43251bf762b23a408ab34 Monotone-Revision: 01ccf525a7c4b4290cf3f8cbe10dbecae92c26ec Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T16:59:35 Monotone-Branch: ca.inverse.sogo --- .../Appointments/SOGoAppointmentFolders.m | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentFolders.m b/SoObjects/Appointments/SOGoAppointmentFolders.m index 3cfba791b..7e861f424 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolders.m +++ b/SoObjects/Appointments/SOGoAppointmentFolders.m @@ -58,7 +58,6 @@ @interface SOGoParentFolder (Private) -- (NSException *) initSubscribedSubFolders; - (NSException *) _fetchPersonalFolders: (NSString *) sql withChannel: (EOAdaptorChannel *) fc; @@ -74,6 +73,33 @@ static SoSecurityManager *sm = nil; sm = [SoSecurityManager sharedSecurityManager]; } ++ (SOGoWebDAVAclManager *) webdavAclManager +{ + static SOGoWebDAVAclManager *aclManager = nil; + + if (!aclManager) + { + aclManager = [[super webdavAclManager] copy]; + [aclManager + registerDAVPermission: davElement (@"write", XMLNS_WEBDAV) + abstract: NO + withEquivalent: SoPerm_AddDocumentsImagesAndFiles + asChildOf: davElement (@"all", XMLNS_WEBDAV)]; + [aclManager + registerDAVPermission: davElement (@"write-properties", XMLNS_WEBDAV) + abstract: YES + withEquivalent: SoPerm_AddDocumentsImagesAndFiles + asChildOf: davElement (@"write", XMLNS_WEBDAV)]; + [aclManager + registerDAVPermission: davElement (@"write-content", XMLNS_WEBDAV) + abstract: YES + withEquivalent: SoPerm_AddDocumentsImagesAndFiles + asChildOf: davElement (@"write", XMLNS_WEBDAV)]; + } + + return aclManager; +} + - (id) init { if ((self = [super init])) @@ -489,33 +515,6 @@ static SoSecurityManager *sm = nil; return error; } -+ (SOGoWebDAVAclManager *) webdavAclManager -{ - static SOGoWebDAVAclManager *aclManager = nil; - - if (!aclManager) - { - aclManager = [[super webdavAclManager] copy]; - [aclManager - registerDAVPermission: davElement (@"write", XMLNS_WEBDAV) - abstract: NO - withEquivalent: SoPerm_AddDocumentsImagesAndFiles - asChildOf: davElement (@"all", XMLNS_WEBDAV)]; - [aclManager - registerDAVPermission: davElement (@"write-properties", XMLNS_WEBDAV) - abstract: YES - withEquivalent: SoPerm_AddDocumentsImagesAndFiles - asChildOf: davElement (@"write", XMLNS_WEBDAV)]; - [aclManager - registerDAVPermission: davElement (@"write-content", XMLNS_WEBDAV) - abstract: YES - withEquivalent: SoPerm_AddDocumentsImagesAndFiles - asChildOf: davElement (@"write", XMLNS_WEBDAV)]; - } - - return aclManager; -} - - (BOOL) hasProxyCalendarsWithWriteAccess: (BOOL) write forUserWithLogin: (NSString *) userLogin { From b995b9acdc0baa9b95854e8713b4bb6fba0ddefb Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 17:02:57 +0000 Subject: [PATCH 08/13] Monotone-Parent: 01ccf525a7c4b4290cf3f8cbe10dbecae92c26ec Monotone-Revision: 4aa0c2e4faed6ef081103161e7bf29d4f76520eb Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T17:02:57 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 9 ++++--- SoObjects/SOGo/SOGoParentFolder.m | 44 +++++++++++++++++++------------ 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f419ec4a..498a00c18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,9 +17,12 @@ (_fetchPersonalFolders:withChannel:): we no longer check access rights from here as this method is too low level and prevent other mechanisms from working properly. - (-lookupName:inContext:acquire:): we now check the "AccessObject" - right from here before returning the found object. We also make - use of the new "ignoreRights" method (see below) to that end. + (-lookupPersonalFolder:ignoringRights:): new method enabling the + lookup of a user's personal folders only and offering the choice + of respecting (or not) the active user's permission before + returning it. + (-lookupName:inContext:acquire:): we now make use of the above + method when looking up personal folders ("personal" or not). (-toManyRelationShipKeys): same as lookupName... above. * SoObjects/SOGo/SOGoObject.m (-ignoreRights): new utility method diff --git a/SoObjects/SOGo/SOGoParentFolder.m b/SoObjects/SOGo/SOGoParentFolder.m index e9ceb93aa..52982439a 100644 --- a/SoObjects/SOGo/SOGoParentFolder.m +++ b/SoObjects/SOGo/SOGoParentFolder.m @@ -392,23 +392,8 @@ static SoSecurityManager *sm = nil; obj = [super lookupName: name inContext: lookupContext acquire: NO]; if (!obj) { - // Lookup in personal folders - error = [self initSubFolders]; - if (error) - { - [self errorWithFormat: @"a database error occured: %@", [error reason]]; - obj = [NSException exceptionWithHTTPStatus: 503]; - } - else - { - obj = [subFolders objectForKey: name]; - if (obj && ![self ignoreRights] - && [sm validatePermission: SOGoPerm_AccessObject - onObject: obj - inContext: context]) - obj = nil; - } - + obj = [self lookupPersonalFolder: name + ignoringRights: NO]; if (!obj) { // Lookup in subscribed folders @@ -426,6 +411,31 @@ static SoSecurityManager *sm = nil; return obj; } +- (id) lookupPersonalFolder: (NSString *) name + ignoringRights: (BOOL) ignoreRights +{ + NSException *error; + id obj; + + error = [self initSubFolders]; + if (error) + { + [self errorWithFormat: @"a database error occured: %@", [error reason]]; + obj = [NSException exceptionWithHTTPStatus: 503]; + } + else + { + obj = [subFolders objectForKey: name]; + if (obj && !ignoreRights && ![self ignoreRights] + && [sm validatePermission: SOGoPerm_AccessObject + onObject: obj + inContext: context]) + obj = nil; + } + + return obj; +} + - (NSArray *) subFolders { NSMutableArray *ma; From 023c8da1738e1ea99830596f2ae9fcdbcd63b47c Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 17:03:13 +0000 Subject: [PATCH 09/13] Monotone-Parent: 4aa0c2e4faed6ef081103161e7bf29d4f76520eb Monotone-Revision: e12c6a7ac6a504dcbea24890a7be8b72b8dc91a4 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T17:03:13 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ UI/Scheduler/UIxCalListingActions.m | 19 ------------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 498a00c18..2ec8df6e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2010-07-15 Wolfgang Sourdeau + * UI/Scheduler/UIxCalListingActions.m + (_aptFolder:withClientObject:): removed unused method. + * UI/WebServerResources/UIxAppointmentEditor.js (onComposeToAllAttendees): take the status image DIV into account when detecting the user fullnames. diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index dd6ab8986..3329bb799 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -234,25 +234,6 @@ static NSArray *tasksFields = nil; } } -- (SOGoAppointmentFolder *) _aptFolder: (NSString *) folder - withClientObject: (SOGoAppointmentFolder *) clientObject -{ - SOGoAppointmentFolder *aptFolder; - NSArray *folderParts; - - if ([folder isEqualToString: @"/"]) - aptFolder = clientObject; - else - { - folderParts = [folder componentsSeparatedByString: @":"]; - aptFolder - = [clientObject lookupCalendarFolderForUID: - [folderParts objectAtIndex: 0]]; - } - - return aptFolder; -} - - (void) _fixComponentTitle: (NSMutableDictionary *) component withType: (NSString *) type { From c6532f9d73295bbe54d831f4b17c84bccae35d04 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 17:05:29 +0000 Subject: [PATCH 10/13] Monotone-Parent: e12c6a7ac6a504dcbea24890a7be8b72b8dc91a4 Monotone-Revision: a3bdc2441cad158c03e3bb175dd766004db14021 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T17:05:29 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 +++ .../Appointments/SOGoAppointmentFolder.h | 1 - .../Appointments/SOGoAppointmentFolder.m | 34 ++----------------- .../Appointments/SOGoAppointmentObject.m | 6 ++-- 4 files changed, 11 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ec8df6e7..81425048f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-07-15 Wolfgang Sourdeau + * SoObjects/Appointments/SOGoAppointmentFolder.m + (-lookupCalendarFolderForUID:): removed useless method, which can + be replaced with -[SOGoUser personalCalendarFolderInContext:]. + * UI/Scheduler/UIxCalListingActions.m (_aptFolder:withClientObject:): removed unused method. diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.h b/SoObjects/Appointments/SOGoAppointmentFolder.h index 7e88ebfb5..7c1e70f3b 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoAppointmentFolder.h @@ -123,7 +123,6 @@ typedef enum { - (id) lookupHomeFolderForUID: (NSString *) _uid inContext: (id) _ctx; -- (SOGoAppointmentFolder *) lookupCalendarFolderForUID: (NSString *) uid; - (NSArray *) lookupCalendarFoldersForUID: (NSString *) theUID; - (NSArray *) lookupCalendarFoldersForUIDs: (NSArray *) _uids inContext: (id) _ctx; diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index ee1a9d3af..70a8e3aaf 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -2644,36 +2644,6 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir return result; } -// -// This method returns the personal calendar of a specific user. -// -- (SOGoAppointmentFolder *) lookupCalendarFolderForUID: (NSString *) uid -{ - SOGoFolder *currentContainer; - SOGoAppointmentFolders *parent; - NSException *error; - - currentContainer = [[container container] container]; - currentContainer = [currentContainer lookupName: uid - inContext: context - acquire: NO]; - parent = [currentContainer lookupName: @"Calendar" inContext: context - acquire: NO]; - currentContainer = [parent lookupName: @"personal" inContext: context - acquire: NO]; - if (!currentContainer) - { - error = [parent newFolderWithName: [parent defaultFolderName] - andNameInContainer: @"personal"]; - if (!error) - currentContainer = [parent lookupName: @"personal" - inContext: context - acquire: NO]; - } - - return (SOGoAppointmentFolder *) currentContainer; -} - // // This method returns an array containing all the calendar folders // of a specific user, excluding her/his subscriptions. @@ -2712,6 +2682,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir NSMutableArray *folders; NSEnumerator *e; NSString *uid, *ownerLogin; + SOGoUser *user; id folder; ownerLogin = [self ownerInContext: context]; @@ -2725,7 +2696,8 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir folder = self; else { - folder = [self lookupCalendarFolderForUID: uid]; + user = [SOGoUser userWithLogin: uid]; + folder = [user personalCalendarFolderInContext: context]; if (![folder isNotNull]) [self logWithFormat:@"Note: did not find folder for uid: '%@'", uid]; } diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 896c23d2e..5e43eafc7 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -163,7 +163,8 @@ if (!object) { // Create the event in the user's personal calendar. - folder = [container lookupCalendarFolderForUID: uid]; + folder = [[SOGoUser userWithLogin: uid] + personalCalendarFolderInContext: context]; object = [SOGoAppointmentObject objectWithName: nameInContainer inContainer: folder]; [object setIsNew: YES]; @@ -265,7 +266,8 @@ // Invitations are always written to the personal folder; it's not necessay // to look into all folders of the user - folder = [container lookupCalendarFolderForUID: theUID]; + folder = [[SOGoUser userWithLogin: theUID] + personalCalendarFolderInContext: context]; object = [folder lookupName: nameInContainer inContext: context acquire: NO]; if (![object isKindOfClass: [NSException class]]) From 2926f2f22da412058891ccca19f4e5f742f622a1 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 17:05:34 +0000 Subject: [PATCH 11/13] Monotone-Parent: a3bdc2441cad158c03e3bb175dd766004db14021 Monotone-Revision: b034ac1c0af075ed2d87791ac8da96f40ca72ae5 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T17:05:34 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoParentFolder.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SoObjects/SOGo/SOGoParentFolder.h b/SoObjects/SOGo/SOGoParentFolder.h index bd5bee7de..cfd272121 100644 --- a/SoObjects/SOGo/SOGoParentFolder.h +++ b/SoObjects/SOGo/SOGoParentFolder.h @@ -54,6 +54,9 @@ - (NSException *) newFolderWithName: (NSString *) name nameInContainer: (NSString **) newNameInContainer; +- (id) lookupPersonalFolder: (NSString *) name + ignoringRights: (BOOL) ignoreRights; + @end #endif /* SOGOPARENTFOLDERS_H */ From ec6dd4915b5940cdefaffa66cb96ba9cf136d178 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 17:06:29 +0000 Subject: [PATCH 12/13] Monotone-Parent: b034ac1c0af075ed2d87791ac8da96f40ca72ae5 Monotone-Revision: 60e6c68ce28bf8053a6fe5aa44b21c2c115e30b1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T17:06:29 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ SoObjects/SOGo/SOGoUser.m | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81425048f..d9d37bd12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-07-15 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoUser.m (-personalCalendarFolderInContext:): + we now make use of -[SOGoParentFolder + lookupPersonalFolder:ignoringRights:] with @"personal" and YES as + arguments. + * SoObjects/Appointments/SOGoAppointmentFolder.m (-lookupCalendarFolderForUID:): removed useless method, which can be replaced with -[SOGoUser personalCalendarFolderInContext:]. diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 9d124b7c1..15b217c28 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -599,9 +599,8 @@ - (SOGoAppointmentFolder *) personalCalendarFolderInContext: (WOContext *) context { - return [[self calendarsFolderInContext: context] lookupName: @"personal" - inContext: context - acquire: NO]; + return [[self calendarsFolderInContext: context] lookupPersonalFolder: @"personal" + ignoringRights: YES]; } // - (id) schedulingCalendarInContext: (id) _ctx From bafbffcf6db0030faf4bad24919b269cc91c4e47 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 17:10:46 +0000 Subject: [PATCH 13/13] Monotone-Parent: 60e6c68ce28bf8053a6fe5aa44b21c2c115e30b1 Monotone-Revision: 77a1a396ead2722d4c170d71c3f90eb39e0a4eee Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T17:10:46 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 1 + UI/WebServerResources/UIxAppointmentEditor.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9d37bd12..229527c5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ * UI/WebServerResources/UIxAppointmentEditor.js (onComposeToAllAttendees): take the status image DIV into account when detecting the user fullnames. + (onComposeToUndecidedAttendees): same as above. * Tests/Integration/test-davacl.py (DAVCalendarPublicAclTest.testCollectionAccessNormalUser): print diff --git a/UI/WebServerResources/UIxAppointmentEditor.js b/UI/WebServerResources/UIxAppointmentEditor.js index 1dddfe991..fd9e6aacc 100644 --- a/UI/WebServerResources/UIxAppointmentEditor.js +++ b/UI/WebServerResources/UIxAppointmentEditor.js @@ -137,8 +137,15 @@ function onComposeToUndecidedAttendees() var attendees = $$("DIV#attendeesMenu LI.attendee.needs-action"); var addresses = new Array(); attendees.each(function(item) { - var address = item.firstChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">"; - addresses.push(address); + var textChild = null; + var childNodes = item.childNodes; + for (var i = 0; !textChild && i < childNodes.length; i++) { + if (childNodes[i].nodeType == 3) { + textChild = childNodes[i]; + var address = textChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">"; + addresses.push(address); + } + } }); if (window.opener) window.opener.openMailTo(addresses.join(","));