Merge pull request #4809 from FinnStutzenstein/fixRestrictionWithoutRestrictedDataCache

Fix restriction without restricted data cache
This commit is contained in:
Emanuel Schütze 2019-06-25 20:56:31 +02:00 committed by GitHub
commit 585b569bbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -45,7 +45,6 @@ export class RoutingStateService {
) )
.subscribe((event: any[]) => { .subscribe((event: any[]) => {
this._previousUrl = event[0].urlAfterRedirects; this._previousUrl = event[0].urlAfterRedirects;
console.log('prev URL: ', this._previousUrl);
}); });
} }
} }

View File

@ -396,6 +396,14 @@ class ElementCache:
for collection_string, full_data in changed_elements.items(): for collection_string, full_data in changed_elements.items():
restricter = self.cachables[collection_string].restrict_elements restricter = self.cachables[collection_string].restrict_elements
elements = await restricter(user_id, full_data) elements = await restricter(user_id, full_data)
# Add removed objects (through restricter) to deleted elements.
full_data_ids = set([data["id"] for data in full_data])
restricted_data_ids = set([data["id"] for data in elements])
for id in full_data_ids - restricted_data_ids:
deleted_elements.append(get_element_id(collection_string, id))
if elements:
restricted_data[collection_string] = elements restricted_data[collection_string] = elements
return restricted_data, deleted_elements return restricted_data, deleted_elements