editAnnotation: explicitly refuse to change layer, fixes #2818

This commit is contained in:
Will Thompson 2015-07-14 10:48:05 +02:00 committed by j
parent 1ef7101761
commit d3c18a5859

View file

@ -278,6 +278,9 @@ def editAnnotation(request, data):
a = get_object_or_404_json(models.Annotation, public_id=data['id'])
if a.editable(request.user):
layer = get_by_id(settings.CONFIG['layers'], a.layer)
if 'layer' in data and data['layer'] != a.layer:
response = json_response(status=400, text='cannot change annotation layer')
return render_to_json_response(response)
for key in ('value', 'in', 'out'):
if key in data:
if key == 'value' and layer['type'] == 'entity':