Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove init script in favor of having a default user and password #11

Closed
se7entyse7en opened this issue May 2, 2019 · 2 comments · Fixed by #48
Closed

Remove init script in favor of having a default user and password #11

se7entyse7en opened this issue May 2, 2019 · 2 comments · Fixed by #48

Comments

@se7entyse7en
Copy link
Contributor

Currently, the installation of the sandbox requires running an init script first in order to set user and password. We could remove this step in favor of using a default one.

See context here.

@smacker
Copy link
Contributor

smacker commented May 2, 2019

one note: this is still unapproved by product. It makes sense to implement but maybe not merge yet.

@smacker
Copy link
Contributor

smacker commented May 6, 2019

Taking into account that sandbox is meant to be used locally we can disable authorization completely.
The user still must be created but we can change auth type and always use admin user.
Here is an example of how to do that:

diff --git a/srcd/superset/superset_config.py b/srcd/superset/superset_config.py
index 2de6b700..1ccb1c1a 100644
--- a/srcd/superset/superset_config.py
+++ b/srcd/superset/superset_config.py
@@ -1,6 +1,7 @@
 import os

 from werkzeug.contrib.cache import RedisCache
+from flask_appbuilder.security.manager import AUTH_REMOTE_USER


 # Helper functions
@@ -17,6 +18,21 @@ def get_env_variable(var_name, default=None):
                         .format(var_name)
             raise EnvironmentError(error_msg)

+# Disable authorization by always using admin user
+
+AUTH_TYPE = AUTH_REMOTE_USER
+
+class RemoteUserMiddleware(object):
+    def __init__(self, app):
+        self.app = app
+
+    def __call__(self, environ, start_response):
+        environ['REMOTE_USER'] = 'admin'
+        return self.app(environ, start_response)
+
+
+ADDITIONAL_MIDDLEWARE = [RemoteUserMiddleware, ]
+
 # Branding

 APP_NAME = 'Source{d}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants