diff --git a/ChangeLog b/ChangeLog index 6a9dd0b67..9e29d7f01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-12-20 Wolfgang Sourdeau + * UI/Contacts/UIxContactFoldersView.m ([UIxContactFoldersView + -checkRightsAction]): new method similar to the one with the same + name in UIxCalMainView.m. + * UI/Common/UIxAclEditor.m ([UIxAclEditor -saveAclsAction]): added code to handle the publishing of freebusy information. diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index ae9ae37ea..4219446d0 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -30,6 +30,7 @@ #import #import #import +#import #import "common.h" @@ -210,4 +211,67 @@ return response; } +- (SOGoContactGCSFolder *) contactFolderForUID: (NSString *) uid +{ + SOGoFolder *upperContainer; + SOGoUserFolder *userFolder; + SOGoContactFolders *contactFolders; + SOGoContactGCSFolder *contactFolder; + SoSecurityManager *securityManager; + + upperContainer = [[[self clientObject] container] container]; + userFolder = [SOGoUserFolder objectWithName: uid + inContainer: upperContainer]; + contactFolders = [SOGoContactFolders objectWithName: @"Contacts" + inContainer: userFolder]; + contactFolder = [SOGoContactGCSFolder objectWithName: @"personal" + inContainer: contactFolders]; + [contactFolder + setOCSPath: [NSString stringWithFormat: @"/Users/%@/Contacts/personal", uid]]; + [contactFolder setOwner: uid]; + + securityManager = [SoSecurityManager sharedSecurityManager]; + + return (([securityManager validatePermission: SoPerm_AccessContentsInformation + onObject: contactFolder + inContext: context] == nil) + ? contactFolder : nil); +} + +- (id ) checkRightsAction +{ + WOResponse *response; + NSUserDefaults *ud; + NSString *uids; + NSMutableString *rights; + NSArray *ids; + unsigned int count, max; + BOOL result; + + ud = [[context activeUser] userDefaults]; + uids = [ud objectForKey: @"additionaladdressbooks"]; + + 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++) + { + result = ([self contactFolderForUID: [ids objectAtIndex: count]] != nil); + if (count == 0) + [rights appendFormat: @"%d", result]; + else + [rights appendFormat: @",%d", result]; + } + } + [response appendContentString: rights]; + + return response; +} + @end