I have a hackish, hard-coded fix for this. A better fix would involve some 
to the DocumentPageResult model, but this works and I didn't feel like 
refactoring a bunch of code...

In /usr/share/mayan-edms/mayan/apps/acls/managers.py, after line 144 (in 
the filter_by_access function), paste this in:
                # added for fix page search bug-BEGIN
                # Perform iterative filtering.
                if str(queryset.model) == "<class 
'documents.models.DocumentPageResult'>":
                    result = []
                    for entry in queryset:
                        try:
                            self.check_access(permissions=permission, user=
user, obj=entry.document)
                        except PermissionDenied:
                            pass
                        else:
                            result.append(entry.pk)
                    return queryset.filter(pk__in=result)
                # END

Here's a wider view of the code in context:
    def filter_by_access(self, permission, user, queryset):
        if user.is_superuser or user.is_staff:
            logger.debug('Unfiltered queryset returned to user "%s" as 
superuser or staff',
                         user)
            return queryset

        try:
            Permission.check_permissions(
                requester=user, permissions=(permission,)
            )
        except PermissionDenied:
            user_roles = []
            for group in user.groups.all():
                for role in group.roles.all():
                    user_roles.append(role)

            try:
                parent_accessor = ModelPermission.get_inheritance(
                    model=queryset.model
                )
            except KeyError:
                parent_acl_query = Q()
                # added for fix page search bug-BEGIN
                # Perform iterative filtering.
                if str(queryset.model) == "<class 
'documents.models.DocumentPageResult'>":
                    result = []
                    for entry in queryset:
                        try:
                            self.check_access(permissions=permission, user=
user, obj=entry.document)
                        except PermissionDenied:
                            pass
                        else:
                            result.append(entry.pk)
                    return queryset.filter(pk__in=result)
                # END
            else:
                instance = queryset.first()
                if instance:
                    parent_object = getattr(instance, parent_accessor)

                    try:
                        # Try to see if parent_object is a function

and restart your web server.

On Wednesday, February 28, 2018 at 11:43:18 AM UTC-5, Ray Hendricks wrote:
>
> No, I didn't. I'm currently interviewing developers to work on Mayan-EDMS 
> for us.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to