Fix ACL filtering case #3
Test case #3: Generic Foreign Key, multiple ContentTypes + object IDs. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
@@ -61,8 +61,6 @@ class AccessControlListManager(models.Manager):
|
||||
)
|
||||
).values('ct_fk_combination')
|
||||
|
||||
field_lookup = 'pk__in'
|
||||
|
||||
acl_filter = self.annotate(
|
||||
ct_fk_combination=Concat(
|
||||
'content_type', V('-'), 'object_id', output_field=CharField()
|
||||
@@ -72,6 +70,8 @@ class AccessControlListManager(models.Manager):
|
||||
ct_fk_combination__in=content_type_object_id_queryset
|
||||
).values('object_id')
|
||||
|
||||
field_lookup = 'object_id__in'
|
||||
|
||||
result.append(Q(**{field_lookup: acl_filter}))
|
||||
else:
|
||||
# Case 2: Related field of a single type, single ContentType,
|
||||
|
||||
Reference in New Issue
Block a user