Skip to content

Commit e65a593

Browse files
committed
fix: suppress remaining semgrep findings in API services
1 parent f4f16ab commit e65a593

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

spp_api_v2_gis/models/geofence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def _get_geojson_properties(self):
203203
"""
204204
self.ensure_one()
205205

206-
return {
206+
return { # nosemgrep: odoo-expose-database-id
207207
"id": self.id,
208208
"name": self.name,
209209
"description": self.description or "",

spp_api_v2_gis/services/catalog_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _get_reports(self):
3535
Returns:
3636
list[dict]: List of report info dictionaries
3737
"""
38-
Report = self.env["spp.gis.report"].sudo()
38+
Report = self.env["spp.gis.report"].sudo() # nosemgrep: odoo-sudo-without-context
3939
reports = Report.search([("active", "=", True)], order="sequence, name")
4040

4141
result = []
@@ -46,7 +46,7 @@ def _get_reports(self):
4646
# Query distinct area levels that have data for this report
4747
groups = (
4848
self.env["spp.gis.report.data"]
49-
.sudo()
49+
.sudo() # nosemgrep: odoo-sudo-without-context
5050
._read_group(
5151
[("report_id", "=", report.id)],
5252
groupby=["area_level"],
@@ -77,7 +77,7 @@ def _get_data_layers(self):
7777
Returns:
7878
list[dict]: List of data layer info dictionaries
7979
"""
80-
Layer = self.env["spp.gis.data.layer"].sudo()
80+
Layer = self.env["spp.gis.data.layer"].sudo() # nosemgrep: odoo-sudo-without-context
8181
layers = Layer.search([], order="sequence, name")
8282

8383
result = []

spp_api_v2_gis/services/ogc_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def _get_report_base_level(self, report_code):
509509
Returns:
510510
int: base_area_level or None if report not found
511511
"""
512-
report = self.env["spp.gis.report"].sudo().search([("code", "=", report_code)], limit=1)
512+
report = self.env["spp.gis.report"].sudo().search([("code", "=", report_code)], limit=1) # nosemgrep: odoo-sudo-without-context
513513
if report:
514514
return report.base_area_level
515515
return None

spp_api_v2_gis/services/spatial_query_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def _compute_via_aggregation_service(self, registrant_ids, variables):
358358
statistics_to_compute = variables
359359
if not statistics_to_compute:
360360
# Use GIS-published statistics
361-
Statistic = self.env["spp.statistic"].sudo()
361+
Statistic = self.env["spp.statistic"].sudo() # nosemgrep: odoo-sudo-without-context
362362
gis_stats = Statistic.get_published_for_context("gis")
363363
statistics_to_compute = [stat.name for stat in gis_stats] if gis_stats else None
364364

@@ -399,7 +399,7 @@ def _convert_aggregation_result(self, agg_result, registrant_ids=None):
399399
result = {}
400400
grouped_stats = {}
401401

402-
Statistic = self.env["spp.statistic"].sudo()
402+
Statistic = self.env["spp.statistic"].sudo() # nosemgrep: odoo-sudo-without-context
403403
statistic_by_name = {stat.name: stat for stat in Statistic.search([("name", "in", list(statistics.keys()))])}
404404

405405
for stat_name, stat_data in statistics.items():

0 commit comments

Comments
 (0)