mitai-jinkendo/backend/csv_parser/permissions.py
Lars 4a771f6a83
All checks were successful
Deploy Development / deploy (push) Successful in 50s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s
feat(csv-parser): Implement CSV import functionality with mapping and type conversion
- Added permissions for editing and deleting CSV field mappings.
- Created type converter for CSV cells to handle various data types.
- Implemented database migrations for CSV field mappings and import logs.
- Seeded initial system templates for nutrition and activity data imports.
- Developed admin endpoints for managing system CSV templates.
- Introduced user endpoints for CSV import analysis and mapping retrieval.
- Added tests for core CSV parser functionalities, including delimiter detection and value conversion.
2026-04-09 21:37:19 +02:00

20 lines
614 B
Python

"""Zugriffsregeln für csv_field_mappings (Issue #21)."""
from __future__ import annotations
from typing import Any, Mapping
def user_may_edit_mapping_row(row: Mapping[str, Any], session: Mapping[str, Any]) -> bool:
if session.get("role") == "admin":
return True
if row.get("is_system"):
return False
return str(row.get("profile_id")) == str(session.get("profile_id"))
def user_may_delete_mapping(row: Mapping[str, Any], session: Mapping[str, Any]) -> bool:
if row.get("is_system"):
return False
return str(row.get("profile_id")) == str(session.get("profile_id"))