This is an automated email from the ASF dual-hosted git repository.

uranusjr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 0711735f14 Make the webserver startup respect update_fab_perms (#30246)
0711735f14 is described below

commit 0711735f14991025c7f6bd612ac9288de69383be
Author: Tzu-ping Chung <[email protected]>
AuthorDate: Fri Mar 24 11:45:25 2023 +0800

    Make the webserver startup respect update_fab_perms (#30246)
---
 airflow/api_connexion/security.py | 3 ++-
 airflow/www/security.py           | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/airflow/api_connexion/security.py 
b/airflow/api_connexion/security.py
index 0e3e9b1f37..664899359c 100644
--- a/airflow/api_connexion/security.py
+++ b/airflow/api_connexion/security.py
@@ -41,7 +41,8 @@ def check_authentication() -> None:
 def requires_access(permissions: Sequence[tuple[str, str]] | None = None) -> 
Callable[[T], T]:
     """Factory for decorator that checks current user's permissions against 
required permissions."""
     appbuilder = get_airflow_app().appbuilder
-    appbuilder.sm.sync_resource_permissions(permissions)
+    if appbuilder.update_perms:
+        appbuilder.sm.sync_resource_permissions(permissions)
 
     def requires_access_decorator(func: T):
         @wraps(func)
diff --git a/airflow/www/security.py b/airflow/www/security.py
index 6b2561292a..c152c43cec 100644
--- a/airflow/www/security.py
+++ b/airflow/www/security.py
@@ -204,6 +204,12 @@ class AirflowSecurityManager(SecurityManager, 
LoggingMixin):
             view.datamodel = CustomSQLAInterface(view.datamodel.obj)
         self.perms = None
 
+    def create_db(self):
+        if not self.appbuilder.update_perms:
+            self.log.debug("Skipping db since appbuilder disables 
update_perms")
+            return
+        super().create_db()
+
     def _get_root_dag_id(self, dag_id):
         if "." in dag_id:
             dm = (

Reply via email to