diff --git a/SoObjects/Contacts/SOGoContactFolders.m b/SoObjects/Contacts/SOGoContactFolders.m index 1e0087353..f19cd5f59 100644 --- a/SoObjects/Contacts/SOGoContactFolders.m +++ b/SoObjects/Contacts/SOGoContactFolders.m @@ -169,22 +169,25 @@ - (NSString *) roleOfUser: (NSString *) uid inContext: (WOContext *) context { - NSArray *roles; + NSArray *roles, *traversalPath; NSString *objectName, *role; role = nil; - objectName = [[context objectForKey: @"SoRequestTraversalPath"] - objectAtIndex: 2]; - if ([objectName isEqualToString: @"personal"]) + traversalPath = [context objectForKey: @"SoRequestTraversalPath"]; + if ([traversalPath count] > 1) { - 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; + objectName = [traversalPath 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; diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index b24dd0e3d..85b084927 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -184,23 +184,26 @@ - (NSString *) roleOfUser: (NSString *) uid inContext: (WOContext *) context { - NSArray *roles; + NSArray *roles, *traversalPath; NSString *objectName, *role; role = nil; - objectName = [[context objectForKey: @"SoRequestTraversalPath"] - objectAtIndex: 1]; - if ([objectName isEqualToString: @"Calendar"] - || [objectName isEqualToString: @"Contacts"]) + traversalPath = [context objectForKey: @"SoRequestTraversalPath"]; + if ([traversalPath count] > 1) { - 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; + objectName = [traversalPath objectAtIndex: 1]; + if ([objectName isEqualToString: @"Calendar"] + || [objectName isEqualToString: @"Contacts"]) + { + 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;