dataflow-core 1.0.0__py3-none-any.whl → 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dataflow-core might be problematic. Click here for more details.
- authenticator/__init__.py +3 -0
- authenticator/dataflowairflowauthenticator.py +1 -1
- authenticator/dataflowhubauthenticator.py +0 -0
- authenticator/dataflowsupersetauthenticator.py +57 -0
- authenticator/package/__init__.py +0 -0
- authenticator/package/configuration.py +0 -0
- authenticator/package/models/__init__.py +0 -0
- authenticator/package/models/database.py +0 -0
- authenticator/package/models/session.py +0 -0
- authenticator/package/models/user.py +0 -0
- dataflow/__init__.py +1 -0
- dataflow/configuration.py +0 -0
- dataflow/dataflow.py +3 -2
- dataflow/models/__init__.py +0 -0
- dataflow/models/database.py +0 -0
- dataflow/models/session.py +0 -0
- dataflow/models/user.py +0 -0
- dataflow/utils/__init__.py +0 -0
- dataflow/utils/aws_secrets_manager.py +0 -0
- {dataflow_core-1.0.0.dist-info → dataflow_core-2.0.0.dist-info}/METADATA +4 -8
- {dataflow_core-1.0.0.dist-info → dataflow_core-2.0.0.dist-info}/RECORD +10 -9
- {dataflow_core-1.0.0.dist-info → dataflow_core-2.0.0.dist-info}/WHEEL +1 -1
- {dataflow_core-1.0.0.dist-info → dataflow_core-2.0.0.dist-info}/entry_points.txt +0 -1
- {dataflow_core-1.0.0.dist-info → dataflow_core-2.0.0.dist-info}/top_level.txt +0 -0
authenticator/__init__.py
CHANGED
|
@@ -60,7 +60,7 @@ class DataflowAirflowAuthenticator(FabAirflowSecurityManagerOverride):
|
|
|
60
60
|
|
|
61
61
|
if not user:
|
|
62
62
|
user_role = self.find_role(user_data.role.title())
|
|
63
|
-
user = self.add_user(username=user_data.user_name, first_name=self.not_none(user_data.first_name), last_name=self.not_none(user_data.last_name), email=self.not_none(user_data.email), role=user_role)
|
|
63
|
+
user = self.add_user(username=user_data.user_name, first_name=self.not_none(user_data.first_name), last_name=self.not_none(user_data.last_name), email=self.not_none(user_data.email), role=user_role, password=self.not_none(user_data.password))
|
|
64
64
|
|
|
65
65
|
environ['REMOTE_USER'] = user.username
|
|
66
66
|
self.write_user_id(user_data.user_id)
|
|
File without changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from flask import redirect, request
|
|
2
|
+
from flask_appbuilder.security.views import AuthDBView
|
|
3
|
+
from superset.security import SupersetSecurityManager
|
|
4
|
+
from flask_appbuilder.security.views import expose
|
|
5
|
+
from flask_login import login_user
|
|
6
|
+
from .package.configuration import ConfigurationManager
|
|
7
|
+
from .package.models.database import DatabaseManager
|
|
8
|
+
from .package.models import (
|
|
9
|
+
user as m_user,
|
|
10
|
+
session as m_session
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
class CustomAuthDBView(AuthDBView):
|
|
14
|
+
def __init__(self):
|
|
15
|
+
self.dataflow_config = ConfigurationManager('/dataflow/app/config/dataflow.cfg')
|
|
16
|
+
self.dataflow_database_url = self.dataflow_config.get_config_value('database', 'database_url')
|
|
17
|
+
self.dataflow_db_instance = DatabaseManager(self.dataflow_database_url)
|
|
18
|
+
self.dataflow_db = next(self.dataflow_db_instance.get_session())
|
|
19
|
+
m_user.Base.metadata.create_all(bind=self.dataflow_db_instance.get_engine())
|
|
20
|
+
m_session.Base.metadata.create_all(bind=self.dataflow_db_instance.get_engine())
|
|
21
|
+
|
|
22
|
+
def _get_user_id_from_session(self, session_id):
|
|
23
|
+
query = self.dataflow_db.query(m_session.Session_table).filter(m_session.Session_table.session_id == session_id).first()
|
|
24
|
+
return query.user_id if query!=None else None
|
|
25
|
+
|
|
26
|
+
def _get_user_details_from_user_table(self, user_id):
|
|
27
|
+
user_details = self.dataflow_db.query(m_user.User).filter(m_user.User.user_id == user_id).first()
|
|
28
|
+
return user_details if user_details!=None else None
|
|
29
|
+
|
|
30
|
+
def not_none(self, value):
|
|
31
|
+
return value if value is not None else ""
|
|
32
|
+
|
|
33
|
+
@expose('/login/', methods=['GET'])
|
|
34
|
+
def login(self):
|
|
35
|
+
try:
|
|
36
|
+
session_id = request.cookies.get('dataflow_session')
|
|
37
|
+
|
|
38
|
+
user_id = self._get_user_id_from_session(session_id)
|
|
39
|
+
user_details = self._get_user_details_from_user_table(user_id)
|
|
40
|
+
user = self.appbuilder.sm.find_user(username=user_details.user_name)
|
|
41
|
+
if user:
|
|
42
|
+
login_user(user, remember=False)
|
|
43
|
+
else:
|
|
44
|
+
user = self.appbuilder.sm.add_user(username=self.not_none(user_details.user_name), first_name=self.not_none(user_details.first_name), last_name=self.not_none(user_details.last_name), email=self.not_none(user_details.email), role=self.appbuilder.sm.find_role('Admin'), password=self.not_none(user_details.password))
|
|
45
|
+
if user:
|
|
46
|
+
login_user(user, remember=False)
|
|
47
|
+
|
|
48
|
+
return redirect(self.appbuilder.get_url_for_index)
|
|
49
|
+
|
|
50
|
+
except Exception as e:
|
|
51
|
+
return super().login()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class CustomSecurityManager(SupersetSecurityManager):
|
|
55
|
+
authdbview = CustomAuthDBView
|
|
56
|
+
def __init__(self, appbuilder):
|
|
57
|
+
super(CustomSecurityManager, self).__init__(appbuilder)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
dataflow/__init__.py
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .dataflow import Dataflow
|
dataflow/configuration.py
CHANGED
|
File without changes
|
dataflow/dataflow.py
CHANGED
|
@@ -47,8 +47,9 @@ class Dataflow:
|
|
|
47
47
|
host_name = os.environ["HOSTNAME"]
|
|
48
48
|
user_name = host_name.replace("jupyter-","")
|
|
49
49
|
|
|
50
|
-
vault_path = "
|
|
51
|
-
|
|
50
|
+
vault_path = "variables"
|
|
51
|
+
variable_data = self.secrets_manager.get_secret_by_key(vault_path, user_name, variable_name)
|
|
52
|
+
return variable_data['value']
|
|
52
53
|
|
|
53
54
|
except Exception as e:
|
|
54
55
|
return None
|
dataflow/models/__init__.py
CHANGED
|
File without changes
|
dataflow/models/database.py
CHANGED
|
File without changes
|
dataflow/models/session.py
CHANGED
|
File without changes
|
dataflow/models/user.py
CHANGED
|
File without changes
|
dataflow/utils/__init__.py
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dataflow-core
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Dataflow core package
|
|
5
|
-
Home-page: UNKNOWN
|
|
6
5
|
Author: Dataflow
|
|
7
|
-
Author-email:
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
6
|
+
Author-email:
|
|
10
7
|
Requires-Dist: sqlalchemy
|
|
11
8
|
Requires-Dist: boto3
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
Requires-Dist: psycopg2-binary
|
|
10
|
+
Requires-Dist: pymysql
|
|
15
11
|
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
authenticator/__init__.py,sha256=
|
|
2
|
-
authenticator/dataflowairflowauthenticator.py,sha256=
|
|
1
|
+
authenticator/__init__.py,sha256=A7EfIoO2e0vyt9TXGHPOeS-THDC0KEiaQHdkdzXUVH8,206
|
|
2
|
+
authenticator/dataflowairflowauthenticator.py,sha256=wzd807UAb5ojIVMO8FVHQnNi3Tc78NjkhbDSfzgo2Qg,4790
|
|
3
3
|
authenticator/dataflowhubauthenticator.py,sha256=jsxpB_NZz3n_FGFJzW0yfXR3i-KK1dsVVIQVIN84Pfc,2540
|
|
4
|
+
authenticator/dataflowsupersetauthenticator.py,sha256=UNgem68eg8G-1uAok2yVc6NvUeXaJ-9MPmdpfSyr9Jg,2759
|
|
4
5
|
authenticator/package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
6
|
authenticator/package/configuration.py,sha256=7To6XwH1eESiYp39eqPcswXWwrdBUdPF6xN6WnazOF0,663
|
|
6
7
|
authenticator/package/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
8
|
authenticator/package/models/database.py,sha256=y09pqnglsBBtDZlyhvqDAlpUSFovwAzBAi6jOYl_XNk,896
|
|
8
9
|
authenticator/package/models/session.py,sha256=j6PhbrTMJxEkeDT4Vf5SqGtM_LI_vZy9O4vxn6LtIbc,495
|
|
9
10
|
authenticator/package/models/user.py,sha256=IYogp_vt0yDBG5i936uNPjgTis77VYPzITn9XpQUIyw,788
|
|
10
|
-
dataflow/__init__.py,sha256=
|
|
11
|
+
dataflow/__init__.py,sha256=WTRg8HMpMWSgxYJ9ZGVldx4k07fAbta3mBmZ1hG9mWE,30
|
|
11
12
|
dataflow/configuration.py,sha256=7To6XwH1eESiYp39eqPcswXWwrdBUdPF6xN6WnazOF0,663
|
|
12
|
-
dataflow/dataflow.py,sha256=
|
|
13
|
+
dataflow/dataflow.py,sha256=CAn47BkdUwmTWe-kTSFKfRZYnjx29MG0SrYsXpvSkuo,3726
|
|
13
14
|
dataflow/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
15
|
dataflow/models/database.py,sha256=y09pqnglsBBtDZlyhvqDAlpUSFovwAzBAi6jOYl_XNk,896
|
|
15
16
|
dataflow/models/session.py,sha256=C9crPh6ZDFuL27hZ_zhUXDZZ0ZiIDE8ZD19O_4WPw-I,488
|
|
16
17
|
dataflow/models/user.py,sha256=IYogp_vt0yDBG5i936uNPjgTis77VYPzITn9XpQUIyw,788
|
|
17
18
|
dataflow/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
19
|
dataflow/utils/aws_secrets_manager.py,sha256=FqHm3YRynv580FpFsS0RfI1MSGY5aq-V7t4blpiYsS4,2588
|
|
19
|
-
dataflow_core-
|
|
20
|
-
dataflow_core-
|
|
21
|
-
dataflow_core-
|
|
22
|
-
dataflow_core-
|
|
23
|
-
dataflow_core-
|
|
20
|
+
dataflow_core-2.0.0.dist-info/METADATA,sha256=QkkZH6mxVy1g84_P_yJKosg2sB0l6cDZhOMQzDLvLcQ,222
|
|
21
|
+
dataflow_core-2.0.0.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
|
22
|
+
dataflow_core-2.0.0.dist-info/entry_points.txt,sha256=ppj_EIbYrJJwCPg1kfdsZk5q1N-Ejfis1neYrnjhO8o,117
|
|
23
|
+
dataflow_core-2.0.0.dist-info/top_level.txt,sha256=SZsUOpSCK9ntUy-3Tusxzf5A2e8ebwD8vouPb1dPt_8,23
|
|
24
|
+
dataflow_core-2.0.0.dist-info/RECORD,,
|
|
File without changes
|