1. Kai Diefenbach
  2. django_permissions
  3. Issues
Issue #10 open

Role's get_users, get_groups don't return all users/groups

Jakub Wiśniowski
created an issue

There is a problem with both get_users and get_groups method in Role that causes that not all users/groups are returned.

IMHO the problem is caused by a bug in Django orm: http://code.djangoproject.com/ticket/13768

however I suggest changing code of the mentioned methods to use:



if content: ctype = ContentType.objects.get_for_model(content) prrs = PrincipalRoleRelation.objects.filter( Q(content_idisnull=True)|Q(content_id=content.id), Q(content_typeisnull=True)|Q(content_type=ctype), role=self).exclude(user=None) }}}

instead of:



if content: ctype = ContentType.objects.get_for_model(content) prrs = PrincipalRoleRelation.objects.filter(role=self, content_idin = (None, content.id), content_typein = (None, ctype)).exclude(user=None)


Comments (2)

  1. Jakub Wiśniowski reporter

    Yes it's still true. I have just tried upgrading my project to Django 1.3 and latest django-permissions (instead of my own modifed version) and my tests failed because of this issue.

  2. Log in to comment