return HttpResponse()
-def process_del(request, objects, map_projection, check_rights):
+def process_del(request, objects, map_projection):
"""
Process del
Param: POST Json with feature to del
forbidden_msg = _("You are not allowed to modify information in this zone.")
too_many_obj_msg = _("Too many object in the selection. Please select only one.")
- # Check zone right for the current user
- if check_rights :
- auth_geom = request.user.get_profile().get_geometry_extent()
- if auth_geom :
- ext_coords = ((auth_geom[0], auth_geom[1]), (auth_geom[0], auth_geom[3]), (auth_geom[2], auth_geom[3]), (auth_geom[2], auth_geom[1]), (auth_geom[0], auth_geom[1]))
- auth_poly_geom = Polygon(ext_coords)
- else :
- response_content = {'records': []}
- response = HttpResponse()
- response_content['records'].append({
- 'status': False,
- 'msg': forbidden_msg
- })
- simplejson.dump(response_content, response, ensure_ascii=False, separators=(',', ':'))
- return response
-
- for feature in objects:
- geom = feature.get('geom')
- if geom :
- # See if auth_geom contains geom. If not, refuse the modification : not allowed
- wkt_str = "SRID=%s;%s" % (map_projection, geom)
- geometry = GEOSGeometry(wkt_str)
- srid = settings.GRACE_DATA_PROJECTION
- geometry = geometry.transform(srid, clone=True)
-
- intersect = auth_poly_geom.intersects(geometry)
- if not intersect:
- response_content = {'records': []}
- response = HttpResponse()
- response_content['records'].append({
- 'status': False,
- 'msg': forbidden_msg
- })
- simplejson.dump(response_content, response, ensure_ascii=False, separators=(',', ':'))
- return response
-
# Check that there's only one object.
if len(objects) > 1 :
response_content = {'records': []}
params = request.POST
objects = simplejson.loads(params['data'])
map_projection = params['map_projection']
- return process_del(request, objects, map_projection, True)
+ return process_del(request, objects, map_projection)