only limit grup if needed, do not overwrite clips sort

This commit is contained in:
j 2012-03-23 16:52:20 +01:00
commit 8fac4c558d
2 changed files with 5 additions and 2 deletions

View file

@ -307,6 +307,9 @@ class ItemManager(Manager):
#users can see public items, there own items and items of there groups
else:
allowed_level = settings.CONFIG['capabilities']['canSeeItem'][user.get_profile().get_level()]
qs = qs.filter(Q(level__lte=allowed_level)|Q(user=user)|Q(groups__in=user.groups.all()))
q = Q(level__lte=allowed_level)|Q(user=user)
if user.groups.count():
q |= Q(groups__in=user.groups.all())
qs = qs.filter(q)
#admins can see all available items
return qs