diff --git a/ChangeLog b/ChangeLog index 7dd7a7f0e..5d0336e8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-06-02 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoGCSFolder.m (-aclsForUser:forObjectAtPath:): + extracted db code into a new "_realAclsForUser:forObjectAtPath:" + private method. When the "None" special role is returned, we + remove it from the list. Finally, we don't allow fetching default + roles when the specified uid is "anonymous". + * SoObjects/Contacts/SOGoContactFolders.m (-appendSystemSources): we now add public sources to the list of folders if and only if the active user is the owner of the current parent folder. diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index a196041ec..9e8039802 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -1384,13 +1384,12 @@ static NSArray *childRecordFields = nil; [aclsForObject removeObjectForKey: uid]; } -- (NSArray *) aclsForUser: (NSString *) uid - forObjectAtPath: (NSArray *) objectPathArray +- (NSArray *) _realAclsForUser: (NSString *) uid + forObjectAtPath: (NSArray *) objectPathArray { NSArray *acls; - NSString *objectPath, *module; + NSString *objectPath; NSDictionary *aclsForObject; - SOGoDomainDefaults *dd; objectPath = [objectPathArray componentsJoinedByString: @"/"]; aclsForObject = [aclCache objectForKey: objectPath]; @@ -1401,13 +1400,26 @@ static NSArray *childRecordFields = nil; if (!acls) { acls = [self _fetchAclsForUser: uid forObjectAtPath: objectPath]; - if (!acls) + if (!acls + || ([acls count] == 1 && [acls containsObject: SOGoRole_None])) acls = [NSArray array]; [self _cacheRoles: acls forUser: uid forObjectAtPath: objectPath]; } - if (!([acls count] || [uid isEqualToString: defaultUserID])) - acls = [self aclsForUser: defaultUserID forObjectAtPath: objectPathArray]; + return acls; +} + +- (NSArray *) aclsForUser: (NSString *) uid + forObjectAtPath: (NSArray *) objectPathArray +{ + NSArray *acls; + NSString *module; + SOGoDomainDefaults *dd; + + acls = [self _realAclsForUser: uid forObjectAtPath: objectPathArray]; + if (!([acls count] || [uid isEqualToString: @"anonymous"])) + acls = [self _realAclsForUser: defaultUserID + forObjectAtPath: objectPathArray]; // If we still don't have ACLs defined for this particular resource, // let's go get the domain defaults, if any.