jhettler opened a new issue #8815:
URL: https://github.com/apache/airflow/issues/8815
<!--
Welcome to Apache Airflow! For a smooth issue process, try to answer the
following questions.
Don't worry if they're not all applicable; just try to include what you can
:-)
If you need to include code snippets or logs, please put them in fenced code
blocks. If they're super-long, please use the details tag like
<details><summary>super-long log</summary> lots of stuff </details>
Please delete these comment blocks before submitting the issue.
-->
<!--
IMPORTANT!!!
PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE
NEXT TO "SUBMIT NEW ISSUE" BUTTON!!!
PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!
Please complete the next sections or the issue will be closed.
This questions are the first thing we need to know to understand the context.
-->
**Apache Airflow version**: 1.10.10
**Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
**Environment**:
- **Cloud provider or hardware configuration**:
- **OS** (e.g. from /etc/os-release): Debian GNU/Linux 10 (buster)
- **Kernel** (e.g. `uname -a`): Linux 5ab0eeff230a 5.4.0\-7626\-generic
#30\~1588169883\~20.04\~bbe668a\-Ubuntu SMP Wed Apr 29 21:00:02 UTC x86_64
GNU/Linux
- **Install tools**: official Airflow docker image
- **Others**:
**What happened**:
I have configured RBAC mode and everything work fine, but I would like to
configure unathorized access for users. Otherwise we authorize users via LDAP.
I set
```
# Uncomment to setup Public role name, no authentication needed
AUTH_ROLE_PUBLIC = 'Viewer'
# Will allow user self registration
AUTH_USER_REGISTRATION = True
# The default user self registration role
AUTH_USER_REGISTRATION_ROLE = "Viewer"
```
If I login with user having role Viewer, I can see dag list and few menu
items. But if I am not logged in I see just empty dag list and the same menu
items. If I try to click any menu item, I got the exception below
```
-------------------------------------------------------------------------------
Node: 11af45a15833
-------------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.6/site-packages/flask/app.py", line
2446, in wsgi_app
response = self.full_dispatch_request()
File "/home/airflow/.local/lib/python3.6/site-packages/flask/app.py", line
1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/airflow/.local/lib/python3.6/site-packages/flask/app.py", line
1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/airflow/.local/lib/python3.6/site-packages/flask/_compat.py",
line 39, in reraise
raise value
File "/home/airflow/.local/lib/python3.6/site-packages/flask/app.py", line
1949, in full_dispatch_request
rv = self.dispatch_request()
File "/home/airflow/.local/lib/python3.6/site-packages/flask/app.py", line
1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File
"/home/airflow/.local/lib/python3.6/site-packages/flask_appbuilder/security/decorators.py",
line 109, in wraps
return f(self, *args, **kwargs)
File
"/home/airflow/.local/lib/python3.6/site-packages/flask_appbuilder/views.py",
line 551, in list
widgets = self._list()
File
"/home/airflow/.local/lib/python3.6/site-packages/flask_appbuilder/baseviews.py",
line 1127, in _list
page_size=page_size,
File
"/home/airflow/.local/lib/python3.6/site-packages/flask_appbuilder/baseviews.py",
line 1026, in _get_list_widget
page_size=page_size,
File
"/home/airflow/.local/lib/python3.6/site-packages/flask_appbuilder/models/sqla/interface.py",
line 168, in query
query_count = self._get_base_query(query=query_count, filters=filters)
File
"/home/airflow/.local/lib/python3.6/site-packages/flask_appbuilder/models/sqla/interface.py",
line 85, in _get_base_query
query = filters.apply_all(query)
File
"/home/airflow/.local/lib/python3.6/site-packages/flask_appbuilder/models/filters.py",
line 269, in apply_all
query = flt.apply(query, value)
File
"/home/airflow/.local/lib/python3.6/site-packages/airflow/www_rbac/views.py",
line 2187, in apply
if appbuilder.sm.has_all_dags_access():
File
"/home/airflow/.local/lib/python3.6/site-packages/airflow/www_rbac/security.py",
line 320, in has_all_dags_access
self._has_role(['Admin', 'Viewer', 'Op', 'User']) or
File
"/home/airflow/.local/lib/python3.6/site-packages/airflow/www_rbac/security.py",
line 299, in _has_role
[r.name in role_name_or_list for r in self.get_user_roles()])
File
"/home/airflow/.local/lib/python3.6/site-packages/airflow/www_rbac/security.py",
line 229, in get_user_roles
public_role = appbuilder.config.get('AUTH_ROLE_PUBLIC')
AttributeError: 'NoneType' object has no attribute 'config'
```
<!-- (please include exact error messages if you can) -->
**What you expected to happen**:
Not logged in users see the same as logged in users with the same role.
<!-- What do you think went wrong? -->
**How to reproduce it**:
just set
```
# Uncomment to setup Public role name, no authentication needed
AUTH_ROLE_PUBLIC = 'Viewer'
# Will allow user self registration
AUTH_USER_REGISTRATION = True
# The default user self registration role
AUTH_USER_REGISTRATION_ROLE = "Viewer"
```
and try to open Airflow without logging in
<!---
As minimally and precisely as possible. Keep in mind we do not have access
to your cluster or dags.
If you are using kubernetes, please attempt to recreate the issue using
minikube or kind.
## Install minikube/kind
- Minikube https://minikube.sigs.k8s.io/docs/start/
- Kind https://kind.sigs.k8s.io/docs/user/quick-start/
If this is a UI bug, please provide a screenshot of the bug or a link to a
youtube video of the bug in action
You can include images using the .md sytle of

To record a screencast, mac users can use QuickTime and then create an
unlisted youtube video with the resulting .mov file.
--->
**Anything else we need to know**:
<!--
How often does this problem occur? Once? Every time etc?
Any relevant logs to include? Put them here in side a detail tag:
<details><summary>x.log</summary> lots of stuff </details>
-->
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]