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;