item.find

This commit is contained in:
j 2012-02-14 21:44:04 +05:30
parent 8a4d4f029e
commit 9b21e867b2

View file

@ -269,7 +269,7 @@ class ItemManager(Manager):
qs = qs.filter(id__in=lqs[0].items.all()) qs = qs.filter(id__in=lqs[0].items.all())
return qs return qs
def find(self, data, user): def find(self, data, user=None):
''' '''
query: { query: {
conditions: [ conditions: [
@ -301,7 +301,7 @@ class ItemManager(Manager):
qs = qs.distinct() qs = qs.distinct()
#anonymous can only see public items #anonymous can only see public items
if user.is_anonymous(): if not user or user.is_anonymous():
allowed_level = settings.CONFIG['capabilities']['canSeeItem']['guest'] allowed_level = settings.CONFIG['capabilities']['canSeeItem']['guest']
qs = qs.filter(level__lte=allowed_level) qs = qs.filter(level__lte=allowed_level)
#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