only limit grup if needed, do not overwrite clips sort
This commit is contained in:
parent
f2c0032054
commit
8fac4c558d
2 changed files with 5 additions and 2 deletions
|
@ -116,7 +116,7 @@ attrs = {
|
||||||
'aspect_ratio': models.FloatField(default=0),
|
'aspect_ratio': models.FloatField(default=0),
|
||||||
|
|
||||||
'item': models.ForeignKey('item.Item', related_name='clips'),
|
'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),
|
'user': models.IntegerField(db_index=True, null=True),
|
||||||
|
|
||||||
#seconds
|
#seconds
|
||||||
|
|
|
@ -307,6 +307,9 @@ class ItemManager(Manager):
|
||||||
#users can see public items, there own items and items of there groups
|
#users can see public items, there own items and items of there groups
|
||||||
else:
|
else:
|
||||||
allowed_level = settings.CONFIG['capabilities']['canSeeItem'][user.get_profile().get_level()]
|
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
|
#admins can see all available items
|
||||||
return qs
|
return qs
|
||||||
|
|
Loading…
Reference in a new issue