From: wolfgang Date: Fri, 16 Feb 2007 23:24:16 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1026 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=919b686007fc82bd261b0ed8761051f7ec688818;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1026 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/ChangeLog b/ChangeLog index 832b7b06..5f811c70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-02-16 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoUser.m ([SOGoUser + -rolesForObject:objectinContext:context]): test for + "rolesOfUser:inContext:" in addition to "roleOfUser:...". + + * SoObjects/Appointments/SOGoCalendarComponent.m + ([SOGoCalendarComponent -rolesOfUser:logininContext:context]): + returns the roles of the user on the container object if the event + is uncreated. + 2007-02-15 Wolfgang Sourdeau * UI/MailPartViewers/UIxMailRenderingContext.m: returns the diff --git a/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh b/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh index 2cff4355..ed2e0183 100755 --- a/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh +++ b/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh @@ -5,7 +5,7 @@ DB_USER="sogo" DB_PASS="sogo" -DB_HOST="127.0.0.1" +DB_HOST="192.168.0.4" DB_PORT="5432" DB_NAME="sogo" TIMEZONE="Canada/Eastern" diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 9d4ceb74..6772e5e9 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -834,11 +834,8 @@ static NSNumber *sharedYes = nil; = [self objectClassForResourceNamed: currentId]; deleteObject = [objectClass objectWithName: currentId inContainer: self]; - if ([currentUser isEqualToString: [deleteObject ownerInContext: nil]]) - { - [deleteObject delete]; - [deleteObject primaryDelete]; - } + [deleteObject delete]; + [deleteObject primaryDelete]; } } diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index b2b8e1f9..e2ce7232 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -521,6 +521,3 @@ } @end /* SOGoAppointmentObject */ - - - diff --git a/SoObjects/Appointments/SOGoCalendarComponent.m b/SoObjects/Appointments/SOGoCalendarComponent.m index 6ebce383..c5e6e311 100644 --- a/SoObjects/Appointments/SOGoCalendarComponent.m +++ b/SoObjects/Appointments/SOGoCalendarComponent.m @@ -31,6 +31,7 @@ #import #import +#import #import "common.h" @@ -294,27 +295,40 @@ static BOOL sendEMailNotifications = NO; } } -- (NSString *) roleOfUser: (NSString *) login +- (NSArray *) rolesOfUser: (NSString *) login inContext: (WOContext *) context { AgenorUserManager *um; iCalRepeatableEntityObject *component; - NSString *role, *email; + NSMutableArray *sogoRoles; + NSString *email; + SOGoUser *user; + + sogoRoles = [NSMutableArray new]; + [sogoRoles autorelease]; um = [AgenorUserManager sharedUserManager]; email = [um getEmailForUID: login]; component = [self component]; - if ([component isOrganizer: email]) - role = SOGoRole_Organizer; - else if ([component isParticipant: email]) - role = SOGoRole_Participant; - else if ([[[self container] ownerInContext: nil] isEqualToString: login]) - role = SoRole_Owner; + if (component) + { + if ([component isOrganizer: email]) + [sogoRoles addObject: SOGoRole_Organizer]; + else if ([component isParticipant: email]) + [sogoRoles addObject: SOGoRole_Participant]; + else if ([[container ownerInContext: nil] isEqualToString: login]) + [sogoRoles addObject: SoRole_Owner]; + } else - role = nil; + { + user = [[SOGoUser alloc] initWithLogin: login roles: nil]; + [sogoRoles addObjectsFromArray: [user rolesForObject: container + inContext: context]]; + [user release]; + } - return role; + return sogoRoles; } @end diff --git a/SoObjects/Appointments/product.plist b/SoObjects/Appointments/product.plist index a648d70a..3213aac5 100644 --- a/SoObjects/Appointments/product.plist +++ b/SoObjects/Appointments/product.plist @@ -14,6 +14,7 @@ "View" = ( "Owner", "Delegate", "Assistant" ); "FreeBusyLookup" = ( "Owner", "Delegate", "Assistant", "FreeBusy" ); "Add Documents, Images, and Files" = ( "Owner", "Delegate" ); + "Access Contents Information" = ( "Owner", "Delegate", "Assistant" ); }; }; @@ -26,6 +27,7 @@ defaultRoles = { "View" = ( "Owner", "Delegate", "Organizer", "Authenticated" ); "Change Images and Files" = ( "Owner", "Delegate", "Organizer" ); + "Access Contents Information" = ( "Owner", "Delegate", "Assistant" ); }; }; SOGoTaskObject = { @@ -33,6 +35,7 @@ defaultRoles = { "View" = ( "Owner", "Delegate", "Organizer", "Authenticated" ); "Change Images and Files" = ( "Owner", "Delegate", "Organizer" ); + "Access Contents Information" = ( "Owner", "Delegate", "Assistant" ); }; }; SOGoFreeBusyObject = { diff --git a/SoObjects/Contacts/product.plist b/SoObjects/Contacts/product.plist index 4ff7a937..9c7b5f82 100644 --- a/SoObjects/Contacts/product.plist +++ b/SoObjects/Contacts/product.plist @@ -22,12 +22,18 @@ SOGoContactGCSFolder = { superclass = "SOGoFolder"; + defaultRoles = { + "PUT" = ( "Owner", "Delegate" ); + "Add Documents, Images, and Files" = ( "Owner", "Delegate" ); + }; }; SOGoContactGCSEntry = { superclass = "SOGoContentObject"; defaultRoles = { "View" = ( "Owner", "Delegate", "Organizer", "Authenticated" ); + "PUT" = ( "Owner", "Delegate" ); + "Add Documents, Images, and Files" = ( "Owner", "Delegate" ); }; }; diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index 10d848cf..749882e1 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -417,23 +417,13 @@ static BOOL debugSoParts = NO; _type = [_type lowercaseString]; _subtype = [_subtype lowercaseString]; - if ([_type isEqualToString:@"text"]) { - if ([_subtype isEqualToString:@"plain"] - || [_subtype isEqualToString:@"html"]) - return YES; - - if ([_subtype isEqualToString:@"calendar"]) /* we also fetch calendars */ - return YES; - } - - if ([_type isEqualToString:@"application"]) { - if ([_subtype isEqualToString:@"pgp-signature"]) - return YES; - if ([_subtype hasPrefix:@"x-vnd.kolab."]) - return YES; - } - - return NO; + return (([_type isEqualToString:@"text"] + && ([_subtype isEqualToString:@"plain"] + || [_subtype isEqualToString:@"html"] + || [_subtype isEqualToString:@"calendar"])) + || ([_type isEqualToString:@"application"] + && ([_subtype isEqualToString:@"pgp-signature"] + || [_subtype hasPrefix:@"x-vnd.kolab."]))); } - (void)addRequiredKeysOfStructure:(id)_info path:(NSString *)_p @@ -825,7 +815,7 @@ static BOOL debugSoParts = NO; In case b) or c) fails, we can't do anything because IMAP4 doesn't tell us the ID used in the trash folder. */ - SOGoMailFolder *destFolder; + SOGoMailAccounts *destFolder; NSEnumerator *folders; NSString *currentFolderName, *reason; NSException *error; diff --git a/SoObjects/SOGo/SOGoContentObject.m b/SoObjects/SOGo/SOGoContentObject.m index 724f1914..3c7cc1a1 100644 --- a/SoObjects/SOGo/SOGoContentObject.m +++ b/SoObjects/SOGo/SOGoContentObject.m @@ -19,10 +19,13 @@ 02111-1307, USA. */ -#include "SOGoContentObject.h" -#include "SOGoFolder.h" -#include "common.h" -#include +#import + +#import + +#import "common.h" +#import "SOGoFolder.h" +#import "SOGoContentObject.h" @interface SOGoContentObject(ETag) - (NSArray *)parseETagList:(NSString *)_c; @@ -236,6 +239,27 @@ return [_ctx response]; } +/* security */ +- (NSArray *) rolesOfUser: (NSString *) login + inContext: (WOContext *) context +{ + NSMutableArray *sogoRoles; + SOGoUser *user; + + sogoRoles = [NSMutableArray new]; + [sogoRoles autorelease]; + + if (![container nameExistsInFolder: nameInContainer]) + { + user = [[SOGoUser alloc] initWithLogin: login roles: nil]; + [sogoRoles addObjectsFromArray: [user rolesForObject: container + inContext: context]]; + [user release]; + } + + return sogoRoles; +} + /* E-Tags */ - (id)davEntityTag { diff --git a/SoObjects/SOGo/SOGoFolder.h b/SoObjects/SOGo/SOGoFolder.h index 50c9f8e4..e768cd22 100644 --- a/SoObjects/SOGo/SOGoFolder.h +++ b/SoObjects/SOGo/SOGoFolder.h @@ -55,6 +55,8 @@ - (GCSFolder *)ocsFolder; /* lower level fetches */ +- (BOOL) nameExistsInFolder: (NSString *) objectName; + - (NSArray *)fetchContentObjectNames; - (NSDictionary *)fetchContentStringsAndNamesOfAllObjects; diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 27eabcca..d7fe67b6 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -142,6 +142,23 @@ return [records valueForKey:@"c_name"]; } +- (BOOL) nameExistsInFolder: (NSString *) objectName +{ + NSArray *fields, *records; + EOQualifier *qualifier; + + qualifier + = [EOQualifier qualifierWithQualifierFormat: + [NSString stringWithFormat: @"c_name='%@'", objectName]]; + + fields = [NSArray arrayWithObject: @"c_name"]; + records = [[self ocsFolder] fetchFields: fields + matchingQualifier: qualifier]; + return (records + && ![records isKindOfClass:[NSException class]] + && [records count] > 0); +} + - (NSDictionary *)fetchContentStringsAndNamesOfAllObjects { NSDictionary *files; diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index cf8f8843..a548e523 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -24,6 +24,7 @@ #import #import #import + #import "common.h" #import "NSArray+Utilities.h" diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 4292e7b9..0c7a3947 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -30,6 +30,8 @@ - (NSString *) roleOfUser: (NSString *) uid inContext: (WOContext *) context; +- (NSArray *) rolesOfUser: (NSString *) uid + inContext: (WOContext *) context; @end @@ -159,7 +161,14 @@ aclsFolder = [SOGoAclsFolder aclsFolder]; sogoRoles = [aclsFolder aclsForObject: (SOGoObject *) object forUser: login]; - [rolesForObject addObjectsFromArray: sogoRoles]; + if (sogoRoles) + [rolesForObject addObjectsFromArray: sogoRoles]; + } + if ([object respondsToSelector: @selector (rolesOfUser:inContext:)]) + { + sogoRoles = [object rolesOfUser: login inContext: context]; + if (sogoRoles) + [rolesForObject addObjectsFromArray: sogoRoles]; } if ([object respondsToSelector: @selector (roleOfUser:inContext:)]) { diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index a3424d7b..ce080e9e 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -111,6 +111,10 @@ pageName = "UIxContactsListView"; actionName = "addressBooksContacts"; }; + PUT = { + protectedBy = "PUT"; + actionName = "PUT"; + }; }; }; @@ -189,6 +193,9 @@ pageName = "UIxContactView"; actionName = "vcard"; }; + PUT = { + protectedBy = "PUT"; + }; }; }; diff --git a/UI/MailerUI/UIxMailReplyAction.m b/UI/MailerUI/UIxMailReplyAction.m index cb00981f..40f0abf0 100644 --- a/UI/MailerUI/UIxMailReplyAction.m +++ b/UI/MailerUI/UIxMailReplyAction.m @@ -19,16 +19,16 @@ 02111-1307, USA. */ -#include "UIxMailEditorAction.h" +#import "UIxMailEditorAction.h" @interface UIxMailReplyAction : UIxMailEditorAction @end -#include -#include -#include -#include -#include "common.h" +#import +#import +#import +#import +#import "common.h" @implementation UIxMailReplyAction @@ -110,18 +110,19 @@ } } -- (NSString *)contentForReplyOnParts:(NSDictionary *)_prts keys:(NSArray *)_k { +- (NSString *) contentForReplyOnParts: (NSDictionary *) _prts + keys: (NSArray *) _k +{ static NSString *textPartSeparator = @"\n---\n"; NSMutableString *ms; unsigned i, count; ms = [NSMutableString stringWithCapacity:16000]; - for (i = 0, count = [_k count]; i < count; i++) { NSString *k, *v; k = [_k objectAtIndex:i]; - + // TODO: this is DUP code to SOGoMailObject if ([k isEqualToString:@"body[text]"]) k = @""; @@ -145,10 +146,16 @@ } - (NSString *)contentForReply { - NSArray *keys; - NSDictionary *parts; - - keys = [[self clientObject] plainTextContentFetchKeys]; + NSArray *keys, *partInfos; + NSDictionary *parts, *infos; + SOGoMailObject *co; + + co = [self clientObject]; + keys = [co plainTextContentFetchKeys]; + infos = [co fetchCoreInfos]; + partInfos = [infos objectForKey: keys]; + NSLog (@"infos: '%@'", infos); + if ([keys count] == 0) return nil; diff --git a/UI/MainUI/product.plist b/UI/MainUI/product.plist index ec730eb8..1a32d592 100644 --- a/UI/MainUI/product.plist +++ b/UI/MainUI/product.plist @@ -33,8 +33,9 @@ "View" = ( "Owner", "Delegate", "Assistant" ); "WebDAV Access" = ( "Owner", "Delegate", "Assistant" ); "Access Contents Information" = ( "Owner", "Assistant", "Delegate" ); - "ReadAcls" = ( "Owner", "Delegate", "Assistant" ); + "ReadAcls" = ( "Owner", "Assistant", "Delegate" ); "SaveAcls" = ( "Owner" ); + "Delete Objects" = ( "Owner", "Delegate" ); }; }; SOGoGroupsFolder = { @@ -66,6 +67,13 @@ }; SOGoRootPage = { }; + SOGoFolder = { + methods = { + PUT = { + protectedBy = "Add Documents, Images, and Files"; + }; + }; + }; SOGoUserFolder = { methods = { view = { diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index d9170d8a..b0c3c256 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -303,3 +303,4 @@ validate_endbeforestart = "Enddate is before startdate!"; "Next hour" = "Next hour"; "closeThisWindowMessage" = "Thank you! You may now close this window."; +"Multicolumn Day View" = "Multicolumn Day View"; diff --git a/UI/Scheduler/French.lproj/Localizable.strings b/UI/Scheduler/French.lproj/Localizable.strings index 348dcb48..43aef1b2 100644 --- a/UI/Scheduler/French.lproj/Localizable.strings +++ b/UI/Scheduler/French.lproj/Localizable.strings @@ -319,3 +319,4 @@ validate_endbeforestart = "La date de fin est avant la date de début !"; "Next hour" = "Heure suivante"; "closeThisWindowMessage" = "Merci! Vous pouvez maintenant fermer cette fenêtre."; +"Multicolumn Day View" = "Multicolonne"; diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index 5c2d39c7..da2fda63 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -128,7 +128,7 @@ [stamp setTimeZone: utc]; s = [self iCalParticipantsAndResourcesStringFromQueryParameters]; - template = [NSString stringWithFormat:iCalStringTemplate, + template = [NSString stringWithFormat: iCalStringTemplate, [[self clientObject] nameInContainer], [stamp iCalFormattedDateTimeString], [lStartDate iCalFormattedDateTimeString], diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index e23e664a..41eb62bc 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -761,7 +761,6 @@ return iCalString; } - - (NSArray *) availableCalendars { NSEnumerator *rawContacts; diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 6aa1bfb3..d0f858b2 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -23,7 +23,8 @@ function newEvent(sender, type) { day = currentDay; var user = UserLogin; - if (currentView == "multicolumndayview" && type == "event") + if (sender.parentNode.getAttribute("id") != "toolbar" + && currentView == "multicolumndayview" && type == "event") user = sender.parentNode.parentNode.getAttribute("user"); var hour = sender.getAttribute("hour"); @@ -1072,10 +1073,12 @@ function addContact(tag, fullContactName, contactId, contactName, contactEmail) function onChangeCalendar(list) { var form = document.forms.editform; + log ("before: " + form.getAttribute("action")); var urlElems = form.getAttribute("action").split("/"); urlElems[urlElems.length-4] = list.childNodesWithTag("option")[list.value].innerHTML; form.setAttribute("action", urlElems.join("/")); + log ("after: " + form.getAttribute("action")); } function validateBrowseURL(input) {