diff --git a/ChangeLog b/ChangeLog index 20c5b5599..53b0e1f36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-06-01 Wolfgang Sourdeau + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor + -toolbar]): determine the toolbar filename based on the + permissions declared by the securitymanager. The role mechanism + has been adjusted on a lowerlevel so we can simplify the code. + * SoObjects/SOGo/SOGoContentObject.m ([SOGoContentObject -initWithName:newNameinContainer:newContainer]): read the content directly from here. That way we can determine whether the object diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 910fc8dc6..7f7397c91 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -34,18 +34,20 @@ #import #import #import +#import +#import +#import #import #import #import -#import -#import -#import -#import +#import #import #import #import #import +#import +#import #import "UIxComponent+Scheduler.h" @@ -845,38 +847,41 @@ - (NSString *) toolbar { - SOGoUser *currentUser; SOGoCalendarComponent *clientObject; NSString *toolbarFilename; - iCalPerson *person; iCalPersonPartStat participationStatus; + SoSecurityManager *sm; + NSString *owner; + sm = [SoSecurityManager sharedSecurityManager]; clientObject = [self clientObject]; - currentUser = [[self context] activeUser]; - if ([clientObject isOrganizerOrOwner: currentUser]) + + if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent + onObject: clientObject + inContext: context]) { if ([[clientObject componentTag] isEqualToString: @"vevent"]) toolbarFilename = @"SOGoAppointmentObject.toolbar"; else toolbarFilename = @"SOGoTaskObject.toolbar"; } - else + else if (![sm validatePermission: SOGoCalendarPerm_RespondToComponent + onObject: clientObject + inContext: context]) { /* Lightning does not manage participation status within tasks */ - person = [clientObject participant: currentUser]; - if (person) - { - participationStatus = [person participationStatus]; - if (participationStatus == iCalPersonPartStatAccepted) - toolbarFilename = @"SOGoAppointmentObjectDecline.toolbar"; - else if (participationStatus == iCalPersonPartStatDeclined) - toolbarFilename = @"SOGoAppointmentObjectAccept.toolbar"; - else - toolbarFilename = @"SOGoAppointmentObjectAcceptOrDecline.toolbar"; - } + owner = [clientObject ownerInContext: context]; + participationStatus + = [[clientObject findParticipantWithUID: owner] participationStatus]; + if (participationStatus == iCalPersonPartStatAccepted) + toolbarFilename = @"SOGoAppointmentObjectDecline.toolbar"; + else if (participationStatus == iCalPersonPartStatDeclined) + toolbarFilename = @"SOGoAppointmentObjectAccept.toolbar"; else - toolbarFilename = @"SOGoComponentClose.toolbar"; + toolbarFilename = @"SOGoAppointmentObjectAcceptOrDecline.toolbar"; } + else + toolbarFilename = @"SOGoComponentClose.toolbar"; return toolbarFilename; }