superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: Add link on how to get permission to permission error (#4408)
Date Fri, 16 Feb 2018 04:28:05 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e08296  Add link on how to get permission to permission error (#4408)
7e08296 is described below

commit 7e082968dd7fe4ea7beec57c57523bb77ed1d7cd
Author: timifasubaa <30888507+timifasubaa@users.noreply.github.com>
AuthorDate: Thu Feb 15 20:28:03 2018 -0800

    Add link on how to get permission to permission error (#4408)
    
    * add flag to config
    
    * add troubleshooting link if there is a link
    
    * nits
---
 superset/config.py     | 3 +++
 superset/views/core.py | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/superset/config.py b/superset/config.py
index 05be109..1ada471 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -354,6 +354,9 @@ SILENCE_FAB = True
 # It will be appended at the bottom of sql_lab errors.
 TROUBLESHOOTING_LINK = ''
 
+# This link should lead to a page with instructions on how to gain access to a
+# Datasource. It will be placed at the bottom of permissions errors.
+PERMISSION_INSTRUCTIONS_LINK = ''
 
 # Integrate external Blueprints to the app by passing them to your
 # configuration. These blueprints will get integrated in the app
diff --git a/superset/views/core.py b/superset/views/core.py
index 5b67a7e..0cb52fd 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -64,7 +64,14 @@ DATASOURCE_MISSING_ERR = __('The datasource seems to have been deleted')
 ACCESS_REQUEST_MISSING_ERR = __(
     'The access requests seem to have been deleted')
 USER_MISSING_ERR = __('The user seems to have been deleted')
-DATASOURCE_ACCESS_ERR = __("You don't have access to this datasource")
+perms_instruction_link = config.get('PERMISSION_INSTRUCTIONS_LINK')
+if perms_instruction_link:
+    DATASOURCE_ACCESS_ERR = __(
+        "You don't have access to this datasource. <a href='{}'>(Gain access)</a>"
+        .format(perms_instruction_link),
+    )
+else:
+    DATASOURCE_ACCESS_ERR = __("You don't have access to this datasource")
 
 
 def get_database_access_error_msg(database_name):

-- 
To stop receiving notification emails like this one, please contact
maximebeauchemin@apache.org.

Mime
View raw message