From 0af94773926fa02767d7fcdd293c2b5b3994b49a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Sat, 9 Aug 2008 15:19:10 +0000 Subject: [PATCH] Monotone-Parent: 975188efc102040c8f1f704d2084d9798480bcb8 Monotone-Revision: 90d12047f041f8515efbf14e53d72f0e23f40633 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-08-09T15:19:10 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++ UI/Scheduler/UIxComponentEditor.m | 68 ++++++++++++------------------- 2 files changed, 30 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53878fcb6..ea1761356 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-08-09 Wolfgang Sourdeau + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor + -toolbar]): changed algoritm so that a delegate would really see + what the owner would, depending on his/her rights. + * SoObjects/Mailer/SOGoMailBodyPart.m ([SOGoMailBodyPart -lookupImap4BodyPartKey:inContext:]): find a class based on the mime type of the subpart described by the partInfo. diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index d3d53fd15..c42ee6548 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -1545,7 +1545,8 @@ RANGE(2); #warning the following methods probably share some code... - (NSString *) _toolbarForOwner: (SOGoUser *) ownerUser - andClientObject: (SOGoCalendarComponent *) clientObject + andClientObject: (SOGoContentObject + *) clientObject { NSString *toolbarFilename; iCalPersonPartStat participationStatus; @@ -1576,7 +1577,8 @@ RANGE(2); } - (NSString *) _toolbarForDelegate: (SOGoUser *) ownerUser - andClientObject: (SOGoCalendarComponent *) clientObject + andClientObject: (SOGoContentObject + *) clientObject { SoSecurityManager *sm; NSString *toolbarFilename, *adminToolbar; @@ -1590,56 +1592,38 @@ RANGE(2); currentUser = [context activeUser]; sm = [SoSecurityManager sharedSecurityManager]; - if ([[component attendees] count]) + + if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent + onObject: clientObject + inContext: context]) + toolbarFilename = [self _toolbarForOwner: ownerUser + andClientObject: clientObject]; + else if (![sm validatePermission: SOGoCalendarPerm_RespondToComponent + onObject: clientObject + inContext: context] + && [[component attendees] count] + && [component userIsParticipant: ownerUser] + && ![component userIsOrganizer: ownerUser]) { - if ([component userIsOrganizer: currentUser]) - toolbarFilename = @"SOGoComponentClose.toolbar"; + participationStatus + = [[component findParticipant: ownerUser] participationStatus]; + /* Lightning does not manage participation status within tasks */ + if (participationStatus == iCalPersonPartStatAccepted) + toolbarFilename = @"SOGoAppointmentObjectDecline.toolbar"; + else if (participationStatus == iCalPersonPartStatDeclined) + toolbarFilename = @"SOGoAppointmentObjectAccept.toolbar"; else - { - if ([component userIsOrganizer: ownerUser] - && ![sm validatePermission: SOGoCalendarPerm_ModifyComponent - onObject: clientObject - inContext: context]) - toolbarFilename = adminToolbar; - else if ([component userIsParticipant: ownerUser] - && !([sm validatePermission: SOGoCalendarPerm_RespondToComponent - onObject: clientObject - inContext: context] - && [sm validatePermission: SOGoCalendarPerm_ModifyComponent - onObject: clientObject - inContext: context])) - { - participationStatus - = [[component findParticipant: ownerUser] participationStatus]; - /* Lightning does not manage participation status within tasks */ - if (participationStatus == iCalPersonPartStatAccepted) - toolbarFilename = @"SOGoAppointmentObjectDecline.toolbar"; - else if (participationStatus == iCalPersonPartStatDeclined) - toolbarFilename = @"SOGoAppointmentObjectAccept.toolbar"; - else - toolbarFilename = @"SOGoAppointmentObjectAcceptOrDecline.toolbar"; - } - else - toolbarFilename = @"SOGoComponentClose.toolbar"; - } + toolbarFilename = @"SOGoAppointmentObjectAcceptOrDecline.toolbar"; } else - { - if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent - onObject: clientObject - inContext: context] - || [component userIsOrganizer: currentUser]) - toolbarFilename = adminToolbar; - else - toolbarFilename = @"SOGoComponentClose.toolbar"; - } + toolbarFilename = @"SOGoComponentClose.toolbar"; return toolbarFilename; } - (NSString *) toolbar { - SOGoCalendarComponent *clientObject; + SOGoContentObject *clientObject; NSString *toolbarFilename; SOGoUser *ownerUser;