forked from 0x2620/pandora
remove list option from addDocument, fixes #2032
This commit is contained in:
parent
07f6e46509
commit
49057ac14a
1 changed files with 11 additions and 13 deletions
|
@ -23,9 +23,7 @@ def addDocument(request):
|
||||||
'''
|
'''
|
||||||
add document(s) to item
|
add document(s) to item
|
||||||
takes {
|
takes {
|
||||||
item: string
|
item: string or [string]
|
||||||
or:
|
|
||||||
list: string
|
|
||||||
|
|
||||||
id: string
|
id: string
|
||||||
or
|
or
|
||||||
|
@ -41,6 +39,7 @@ def addDocument(request):
|
||||||
else:
|
else:
|
||||||
ids = [data['id']]
|
ids = [data['id']]
|
||||||
if 'item' in data:
|
if 'item' in data:
|
||||||
|
if isinstance(data['item'], basestring):
|
||||||
item = Item.objects.get(itemId=data['item'])
|
item = Item.objects.get(itemId=data['item'])
|
||||||
if item.editable(request.user):
|
if item.editable(request.user):
|
||||||
for id in ids:
|
for id in ids:
|
||||||
|
@ -48,9 +47,8 @@ def addDocument(request):
|
||||||
document.add(item)
|
document.add(item)
|
||||||
else:
|
else:
|
||||||
response = json_response(status=403, text='permission denied')
|
response = json_response(status=403, text='permission denied')
|
||||||
elif 'list' in data:
|
else:
|
||||||
list = List.get(data['list'])
|
for item in Item.objects.filter(itemId__in=data['item']):
|
||||||
for item in list.get_items(request.user):
|
|
||||||
if item.editable(request.user):
|
if item.editable(request.user):
|
||||||
for id in ids:
|
for id in ids:
|
||||||
document = models.Document.get(id)
|
document = models.Document.get(id)
|
||||||
|
|
Loading…
Reference in a new issue