betodealmeida commented on a change in pull request #5787: Add schema level
access control on csv upload
URL:
https://github.com/apache/incubator-superset/pull/5787#discussion_r218189110
##########
File path: superset/views/core.py
##########
@@ -313,9 +321,21 @@ def form_get(self, form):
form.skip_blank_lines.data = True
form.infer_datetime_format.data = True
form.decimal.data = '.'
- form.if_exists.data = 'append'
+ form.if_exists.data = 'fail'
def form_post(self, form):
+ database = form.con.data
+ schema_name = form.schema.data or ''
+
+ if not self.is_schema_allowed(database, schema_name):
+ message = _('Database "{0}" Schema "{1}" is not allowed for csv
uploads. '
+ 'Please contact Superset
Admin'.format(database.database_name,
+ schema_name))
+ flash(
Review comment:
This can be written in a single language:
```python
flash(message, 'danger')
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]