Skip to content

Commit

Permalink
Fixes issue #364
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Apr 17, 2016
1 parent 899fe19 commit 04f1b17
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,13 @@ def dashboard(**kwargs): # noqa
@expose("/sql/<database_id>/")
@log_this
def sql(self, database_id):
if (
not self.appbuilder.sm.has_access(
'all_datasource_access', 'all_datasource_access')):
flash(
"This view requires the `all_datasource_access` "
"permission", "danger")
return redirect("/tablemodelview/list/")
mydb = db.session.query(
models.Database).filter_by(id=database_id).first()
engine = mydb.get_sqla_engine()
Expand Down Expand Up @@ -778,7 +785,8 @@ def runsql(self):
if (
not self.appbuilder.sm.has_access(
'all_datasource_access', 'all_datasource_access')):
raise Exception("test")
raise Exception(
"This view requires the `all_datasource_access` permission")
content = ""
if mydb:
eng = mydb.get_sqla_engine()
Expand Down

0 comments on commit 04f1b17

Please sign in to comment.