Skip to content

Commit be398f6

Browse files
abhizipstackclaude
andcommitted
fix: extract transformation router and improve RBAC error handling (VAPT #1)
Backend: - Create dedicated transformation router with RESOURCE_NAME="configmodels" so RBAC checks against DATA_TRANSFORMATION instead of projectdetails - Move 9 transformation endpoints from projects/views.py to transformation/views.py (save_model_file, set_model_config_and_reference, set/delete_model_transformation, set_model_presentation, validate_model_file, get_transformation_columns, get_supported_models, generate_formula) - Fix handle_http_request overriding 403 status to 200 — now preserves 4xx/5xx status codes from permission checks Frontend: - Add error notification on set-model 403 instead of silently closing modal - Add setIsLoading(false) in .finally to stop loader on error - Show contextual notification headers (Access Denied, Not Found, Too Many Requests) based on HTTP status instead of generic "Failed" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 26dfa7e commit be398f6

9 files changed

Lines changed: 319 additions & 315 deletions

File tree

backend/backend/core/routers/projects/urls.py

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
create_sample_project,
88
get_project_detail,
99
set_project_schema,
10-
delete_model_transformation,
1110
delete_project,
12-
generate_formula,
1311
get_lineage,
1412
get_lineage_info,
1513
get_model_file_content,
@@ -21,18 +19,11 @@
2119
get_project_tables,
2220
get_projects_list,
2321
get_sql_flow,
24-
get_supported_models,
2522
get_table_schema,
2623
reload_model,
2724
rollback_model_file_content,
28-
save_model_file,
29-
set_model_config_and_reference,
30-
set_model_presentation,
31-
set_model_transformation,
3225
update_project,
33-
validate_model_file,
3426
write_database_file,
35-
get_transformation_columns,
3627
)
3728

3829
# This API will initialize a new visitran project,
@@ -116,59 +107,6 @@
116107
name="write-database-file",
117108
)
118109

119-
# This API will fetch the content of the file from the given path.
120-
VALIDATE_MODEL_FILE = path(
121-
"/<str:project_id>/no_code_model/<str:file_name>/validate",
122-
validate_model_file,
123-
name="validate-no-code-model-file",
124-
)
125-
126-
# This API is used to store the YAML data
127-
# This method is depreciated
128-
SAVE_MODEL_FILE = path(
129-
"/<str:project_id>/no_code_model/<str:file_name>",
130-
save_model_file,
131-
name="save-no-code-model-file",
132-
)
133-
134-
# This API will capture the source and model data from the configuration window
135-
SET_MODEL_CONFIG = path(
136-
"/<str:project_id>/no_code_model/<str:file_name>/set-model",
137-
set_model_config_and_reference,
138-
name="set-no-code-model-config",
139-
)
140-
141-
142-
# This API will capture the source and model data from the configuration window
143-
SET_MODEL_TRANSFORMATION = path(
144-
"/<str:project_id>/no_code_model/<str:file_name>/set-transform",
145-
set_model_transformation,
146-
name="set-no-code-model-transformation",
147-
)
148-
149-
# This API will capture the source and model data from the configuration window
150-
DELETE_MODEL_TRANSFORMATION = path(
151-
"/<str:project_id>/no_code_model/<str:file_name>/delete-transform",
152-
delete_model_transformation,
153-
name="delete-no-code-model-transformation",
154-
)
155-
156-
157-
# This API will capture the source and model data from the configuration window
158-
SET_MODEL_PRESENTATION = path(
159-
"/<str:project_id>/no_code_model/<str:file_name>/set-presentation",
160-
set_model_presentation,
161-
name="set-no-code-model-presentation",
162-
)
163-
164-
165-
# This API will return the available columns in the specific transformation
166-
GET_TRANSFORMATION_COLUMNS = path(
167-
"/<str:project_id>/no_code_model/<str:file_name>/columns",
168-
get_transformation_columns,
169-
name="get-transformation-columns",
170-
)
171-
172110

173111
# This API will fetch the content of the file from the given path.
174112
FETCH_MODEL_TABLE_CONTENT = path(
@@ -192,11 +130,6 @@
192130
name="export-no-code-model-file-csv",
193131
)
194132

195-
GET_SUPPORTED_REFERENCE_MODELS = path(
196-
"/<str:project_id>/no_code_model/<str:file_name>/supported_references",
197-
get_supported_models,
198-
name="get-supported-reference-models",
199-
)
200133

201134
GET_LINEAGE = path("/<str:project_id>/lineage", get_lineage, name="get-lineage")
202135

@@ -205,12 +138,6 @@
205138
# SQL Flow - Table-level lineage with ER diagram style visualization
206139
GET_SQL_FLOW = path("/<str:project_id>/sql-flow", get_sql_flow, name="get-sql-flow")
207140

208-
# This API will generate formula from given prompt
209-
GENERATE_FORMULA = path(
210-
"/<str:project_id>/no_code_model/<str:model_name>/generate_formula",
211-
generate_formula,
212-
name="generate-formula",
213-
)
214141

215142
DELETE_A_PROJECT = path("/<str:project_id>/delete", delete_project, name="delete_project")
216143

@@ -231,22 +158,13 @@
231158
GET_TABLE_CONTENT,
232159
RELOAD_MODEL,
233160
WRITE_DATABASE_FILE,
234-
VALIDATE_MODEL_FILE,
235-
SAVE_MODEL_FILE,
236-
SET_MODEL_CONFIG,
237-
SET_MODEL_TRANSFORMATION,
238-
DELETE_MODEL_TRANSFORMATION,
239-
SET_MODEL_PRESENTATION,
240-
GET_TRANSFORMATION_COLUMNS,
241161
FETCH_MODEL_TABLE_CONTENT,
242162
EXPORT_MODEL_CONTENT_CSV,
243-
GET_SUPPORTED_REFERENCE_MODELS,
244163
ROLLBACK_MODEL_TABLE_CONTENT,
245164
GET_LINEAGE,
246165
GET_LINEAGE_INFO,
247166
GET_SQL_FLOW,
248167
GET_TABLE_SCHEMA,
249-
GENERATE_FORMULA,
250168
]
251169

252170

0 commit comments

Comments
 (0)