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

Not able to use custom security manager getting AttributeError: type object 'AirflowSecurityManager' has no attribute 'get_app' #20449

Closed
1 of 2 tasks
BalaChan97 opened this issue Dec 21, 2021 · 6 comments · Fixed by #21294
Labels
affected_version:2.2 Issues Reported for 2.2 area:core area:webserver Webserver related Issues kind:bug This is a clearly a bug
Milestone

Comments

@BalaChan97
Copy link

BalaChan97 commented Dec 21, 2021

Apache Airflow version

2.2.2 (latest released)

What happened

  File "/home/airflow/.local/lib/python3.7/site-packages/airflow/www/fab_security/sqla/manager.py", line 69, in __init__     super().__init__(appbuilder)
  File "/home/airflow/.local/lib/python3.7/site-packages/airflow/www/fab_security/manager.py", line 178, in __init__
    app = self.appbuilder.get_app
AttributeError: type object 'AirflowSecurityManager' has no attribute 'get_app'

What you expected to happen

No response

How to reproduce

No response

Operating System

linux

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@BalaChan97 BalaChan97 added area:core kind:bug This is a clearly a bug labels Dec 21, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Dec 21, 2021

Thanks for opening your first issue here! Be sure to follow the issue template!

@eladkal eladkal added area:webserver Webserver related Issues affected_version:2.2 Issues Reported for 2.2 labels Jan 14, 2022
@eladkal eladkal added this to the Airflow 2.2.4 milestone Jan 14, 2022
@eladkal
Copy link
Contributor

eladkal commented Feb 2, 2022

I'm able to reproduce it with basic auth on 2.2.3:

In /login when clicking Register:


Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.7/site-packages/flask_appbuilder/views.py", line 127, in this_form_get
    self.form_get(form)
  File "/usr/local/lib/python3.7/site-packages/flask_appbuilder/security/registerviews.py", line 175, in form_get
    self.add_form_unique_validations(form)
  File "/usr/local/lib/python3.7/site-packages/flask_appbuilder/security/registerviews.py", line 155, in add_form_unique_validations
    datamodel_user = self.appbuilder.sm.get_user_datamodel
AttributeError: 'AirflowSecurityManager' object has no attribute 'get_user_datamodel'

@uranusjr
Copy link
Member

uranusjr commented Feb 3, 2022

What is the version of Flask-Appbuilder in your environment? It seems like there are some incompatible changes between it and our own security manager implementation.

@eladkal
Copy link
Contributor

eladkal commented Feb 3, 2022

What is the version of Flask-Appbuilder in your environment? It seems like there are some incompatible changes between it and our own security manager implementation.

For me it's
Flask-AppBuilder==3.4.4

@eladkal
Copy link
Contributor

eladkal commented Feb 3, 2022

Another user report this bug: #20866

@aa3pankaj
Copy link
Contributor

@eladkal AttributeError: 'AirflowSecurityManager' object has no attribute 'get_user_datamodel' seems to be different from the issue reported here i.e AttributeError: type object 'AirflowSecurityManager' has no attribute 'get_app'

issues related to missing methods (including 'get_user_datamodel') in AirflowSecurityManager would be fixed via #21294

For this issue ('get_app'), @BalaChan97 please share your usecase? can you share full stack trace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected_version:2.2 Issues Reported for 2.2 area:core area:webserver Webserver related Issues kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants