From c5698c56f1d2213ccbbba3c719807309cfd0a2c4 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 19 Dec 2006 17:05:28 +0000 Subject: [PATCH] Monotone-Parent: 50485da98a8b2535a5e2511ba4e1bd8025373815 Monotone-Revision: 3539ecd8be9d6a343ed36dd75849ea9713497066 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-12-19T17:05:28 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ UI/Scheduler/UIxCalMainView.m | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/ChangeLog b/ChangeLog index fcfa2ba7a..31f198023 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2006-12-19 Wolfgang Sourdeau + * UI/Scheduler/UIxCalMainView.m ([UIxCalMainView + -checkRightsAction]): new action method that returns a + comma-separated list of boolean values matching the right of the + current user to "view" (as a permission) each foreign calendar + stored in his preferences. + * SoObjects/SOGo/SOGoObject.m ([SOGoObject -setOwner:newOwner]): new method that sets a customOwner, which can be returned with ownerInContext it set. diff --git a/UI/Scheduler/UIxCalMainView.m b/UI/Scheduler/UIxCalMainView.m index a41a63974..35eef4134 100644 --- a/UI/Scheduler/UIxCalMainView.m +++ b/UI/Scheduler/UIxCalMainView.m @@ -128,4 +128,43 @@ static NSMutableArray *yearMenuItems = nil; return response; } +- (id ) checkRightsAction +{ + WOResponse *response; + NSUserDefaults *ud; + NSString *uids, *uid; + NSMutableString *rights; + NSArray *ids; + unsigned int count, max; + BOOL result; + + ud = [[context activeUser] userDefaults]; + uids = [ud stringForKey: @"calendaruids"]; + + response = [context response]; + [response setStatus: 200]; + [response setHeader: @"text/plain; charset=\"utf-8\"" + forKey: @"content-type"]; + rights = [NSMutableString string]; + if ([uids length] > 0) + { + ids = [uids componentsSeparatedByString: @","]; + max = [ids count]; + for (count = 0; count < max; count++) + { + uid = [ids objectAtIndex: count]; + if ([uid hasPrefix: @"-"]) + uid = [uid substringFromIndex: 1]; + result = ([self calendarFolderForUID: uid] != nil); + if (count == 0) + [rights appendFormat: @"%d", result]; + else + [rights appendFormat: @",%d", result]; + } + } + [response appendContentString: rights]; + + return response; +} + @end