only limit grup if needed, do not overwrite clips sort

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

View file

@ -116,7 +116,7 @@ attrs = {
'aspect_ratio': models.FloatField(default=0),
'item': models.ForeignKey('item.Item', related_name='clips'),
'sort': models.ForeignKey('item.ItemSort', related_name='clips'),
'sort': models.ForeignKey('item.ItemSort', related_name='matching_clips'),
'user': models.IntegerField(db_index=True, null=True),
#seconds

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