From 5abb31baf0181fbe1da0a2c7614bfdfa63e2a2cb Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 4 Jul 2007 20:12:28 +0000 Subject: [PATCH] Monotone-Parent: 6a2b142b86238b6988137e5c25e428fc7a5f4ef7 Monotone-Revision: 7c8ba9069f41df75eb34d37babf6ea5227a77d28 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-07-04T20:12:28 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++ .../Appointments/SOGoCalendarComponent.m | 40 +++++++++++++------ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3b465231..ea05b9b29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-07-04 Wolfgang Sourdeau + * SoObjects/Appointments/SOGoCalendarComponent.m + ([SOGoCalendarComponent -contentAsString]): we return the content + based on the permissions returned by the security manager instead + of by looking at the user roles. + * SoObjects/Appointments/SOGoAppointmentFolder.m ([SOGoAppointmentFolder -calendarFolders]): read the calendar folders of the user to whom this folder belongs instead of the diff --git a/SoObjects/Appointments/SOGoCalendarComponent.m b/SoObjects/Appointments/SOGoCalendarComponent.m index 5f707b181..5f987aa5b 100644 --- a/SoObjects/Appointments/SOGoCalendarComponent.m +++ b/SoObjects/Appointments/SOGoCalendarComponent.m @@ -111,23 +111,38 @@ static BOOL sendEMailNotifications = NO; - (NSString *) contentAsString { - NSString *uid; iCalCalendar *tmpCalendar; iCalRepeatableEntityObject *tmpComponent; - NSArray *roles; +// NSArray *roles; +// NSString *uid; + SoSecurityManager *sm; if (!calContent) { - uid = [[context activeUser] login]; - roles = [self aclsForUser: uid]; - if ([roles containsObject: SOGoCalendarRole_Organizer] - || [roles containsObject: SOGoCalendarRole_Participant] - || [roles containsObject: SOGoCalendarRole_ComponentViewer]) - { - calContent = content; - [calContent retain]; - } - else if ([roles containsObject: SOGoCalendarRole_ComponentDAndTViewer]) +// uid = [[context activeUser] login]; +// roles = [self aclsForUser: uid]; +// if ([roles containsObject: SOGoCalendarRole_Organizer] +// || [roles containsObject: SOGoCalendarRole_Participant] +// || [roles containsObject: SOGoCalendarRole_ComponentViewer]) +// calContent = content; +// else if ([roles containsObject: SOGoCalendarRole_ComponentDAndTViewer]) +// { +// tmpCalendar = [[self calendar: NO] copy]; +// tmpComponent = (iCalRepeatableEntityObject *) +// [tmpCalendar firstChildWithTag: [self componentTag]]; +// [self _filterComponent: tmpComponent]; +// calContent = [tmpCalendar versitString]; +// [tmpCalendar release]; +// } +// else +// calContent = nil; + + sm = [SoSecurityManager sharedSecurityManager]; + if (![sm validatePermission: SOGoCalendarPerm_ViewAllComponent + onObject: self inContext: context]) + calContent = content; + else if (![sm validatePermission: SOGoCalendarPerm_ViewDAndT + onObject: self inContext: context]) { tmpCalendar = [[self calendar: NO] copy]; tmpComponent = (iCalRepeatableEntityObject *) @@ -606,7 +621,6 @@ static BOOL sendEMailNotifications = NO; else if ([roles containsObject: SOGoRole_ObjectCreator]) [roles addObject: SOGoCalendarRole_Organizer]; } -// } return roles; }