Skip to content
Snippets Groups Projects
Commit ad289b39 authored by Christian Boettcher's avatar Christian Boettcher
Browse files

change import to already installed package

parent 9ae8e4c5
No related branches found
No related tags found
No related merge requests found
Pipeline #131126 failed
import os, random, string import os, random, string
from authlib.integrations.flask_client import OAuth from authlib.integrations.flask_client import OAuth
from flask import url_for, redirect from flask import url_for, redirect, current_app as app
from flask_login import login_user from flask_login import login_user
from flask_appbuilder import expose, BaseView as AppBuilderBaseView from flask_appbuilder import expose, BaseView as AppBuilderBaseView
from airflow.utils.airflow_flask_app import get_airflow_app
from airflow.plugins_manager import AirflowPlugin from airflow.plugins_manager import AirflowPlugin
import logging import logging
import os import os
...@@ -15,7 +14,6 @@ FAB_ADMIN_ROLE = "Admin" ...@@ -15,7 +14,6 @@ FAB_ADMIN_ROLE = "Admin"
FAB_VIEWER_ROLE = "Viewer" FAB_VIEWER_ROLE = "Viewer"
FAB_PUBLIC_ROLE = "Public" # The "Public" role is given no permissions FAB_PUBLIC_ROLE = "Public" # The "Public" role is given no permissions
app= get_airflow_app()
oauth = OAuth(app) oauth = OAuth(app)
oauth.register( oauth.register(
name='unity', name='unity',
...@@ -53,7 +51,7 @@ class UnityIntegrationAuthView(AppBuilderBaseView): ...@@ -53,7 +51,7 @@ class UnityIntegrationAuthView(AppBuilderBaseView):
# check airflow user backend # check airflow user backend
# check if user already exists, if not create it (with long random password) # check if user already exists, if not create it (with long random password)
sec_manager = app.appbuilder.sm sec_manager = app.appbuilder.sm
fab_user = sec_manager.find_user('username') fab_user = sec_manager.find_user(username=persistent_identifier)
if fab_user is None: # TODO check if None is the rioght thing to compare to if fab_user is None: # TODO check if None is the rioght thing to compare to
characters = string.ascii_letters + string.digits + string.punctuation characters = string.ascii_letters + string.digits + string.punctuation
fab_user = sec_manager.add_user( fab_user = sec_manager.add_user(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment