From ebd5a6cfb6c32e29cbc216d410d58c95f9f62050 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 15 Dec 2006 22:18:55 +0000 Subject: [PATCH] Monotone-Parent: 293e773bade06f97acb90961a13323cdf0e8bcd7 Monotone-Revision: 9f39b351dc2a5dbc00529892e9994ceff8f696d2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-12-15T22:18:55 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 ++++++++ SoObjects/Contacts/SOGoContactFolders.m | 26 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/ChangeLog b/ChangeLog index fd5873f00..0f3382cea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-12-15 Wolfgang Sourdeau + + * SoObjects/Contacts/SOGoContactFolders.m ([SOGoContactFolders + -roleOfUser:uidinContext:context]): new method that returns + SOGoRole_Assistant when the user is an assistant or a delegate on + the "personal" ab object. This is so that setting roles on the + SOGoContactFolders object is not required. + 2006-12-14 Wolfgang Sourdeau * Main/SOGo.m: declare "Freebusy" permissions for the top objects. diff --git a/SoObjects/Contacts/SOGoContactFolders.m b/SoObjects/Contacts/SOGoContactFolders.m index a4c455f58..1e0087353 100644 --- a/SoObjects/Contacts/SOGoContactFolders.m +++ b/SoObjects/Contacts/SOGoContactFolders.m @@ -36,6 +36,8 @@ #import #import +#import + #import "common.h" #import "SOGoContactGCSFolder.h" @@ -164,6 +166,30 @@ return [contactFolders allValues]; } +- (NSString *) roleOfUser: (NSString *) uid + inContext: (WOContext *) context +{ + NSArray *roles; + NSString *objectName, *role; + + role = nil; + objectName = [[context objectForKey: @"SoRequestTraversalPath"] + objectAtIndex: 2]; + if ([objectName isEqualToString: @"personal"]) + { + roles = [[context activeUser] + rolesForObject: [self lookupName: objectName + inContext: context + acquire: NO] + inContext: context]; + if ([roles containsObject: SOGoRole_Assistant] + || [roles containsObject: SOGoRole_Delegate]) + role = SOGoRole_Assistant; + } + + return role; +} + - (BOOL) davIsCollection { return YES;