mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-28 17:57:38 +00:00
(fix) cache sogo_folder_info records and avoid phantom subscriptions (fixes #4010)
This commit is contained in:
@@ -424,7 +424,23 @@ static NSArray *childRecordFields = nil;
|
||||
|
||||
- (GCSFolder *) ocsFolderForPath: (NSString *) _path
|
||||
{
|
||||
return [[self folderManager] folderAtPath: _path];
|
||||
NSDictionary *record;
|
||||
SOGoCache *cache;
|
||||
|
||||
cache = [SOGoCache sharedCache];
|
||||
record = [[cache valueForKey: _path] objectFromJSONString];
|
||||
|
||||
if (!record)
|
||||
{
|
||||
record = [[self folderManager] recordAtPath: _path];
|
||||
|
||||
if (!record)
|
||||
return nil;
|
||||
|
||||
[cache setValue: [record jsonRepresentation] forKey: _path];
|
||||
}
|
||||
|
||||
return [[self folderManager] folderForRecord: record];
|
||||
}
|
||||
|
||||
- (BOOL) folderIsMandatory
|
||||
@@ -578,6 +594,7 @@ static NSArray *childRecordFields = nil;
|
||||
[self removeFolderSettings: moduleSettings
|
||||
withReference: [self folderReference]];
|
||||
[us synchronize];
|
||||
[[SOGoCache sharedCache] removeValueForKey: ocsPath];
|
||||
|
||||
if ([[context request] handledByDefaultHandler])
|
||||
[self sendFolderAdvisoryTemplate: @"Removal"];
|
||||
|
||||
@@ -291,14 +291,8 @@ static SoSecurityManager *sm = nil;
|
||||
// This is important because user A could delete folder X, and user B has subscribed to it.
|
||||
// If the "default roles" are enabled for calendars/address books, -validatePersmission:.. will
|
||||
// work (grabbing the default role) and the deleted resource will be incorrectly returned.
|
||||
//
|
||||
// FIXME - 2015/01/29 - this fix (24c6c8c91d421594bd51f07904d4cd3911cd187c) was reverted. Normally, we should add
|
||||
// [subscribedFolder ocsFolderForPath: [subscribedFolder ocsPath]] to check the existence of the folder but it causes
|
||||
// massive SQL traffic.
|
||||
//
|
||||
// The proper fix would be to check upon login and only upon login if GCS folders that we're subscribed to are still existent.
|
||||
//
|
||||
if (subscribedFolder
|
||||
&& [subscribedFolder ocsFolderForPath: [subscribedFolder ocsPath]]
|
||||
&& ![sm validatePermission: SOGoPerm_AccessObject
|
||||
onObject: subscribedFolder
|
||||
inContext: context])
|
||||
|
||||
Reference in New Issue
Block a user