From 286c083fefc4f4c53ab2ec2822018d10775e1b3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20B=C3=B6ttcher?= <c.boettcher@fz-juelich.de>
Date: Tue, 19 Sep 2023 10:20:50 +0200
Subject: [PATCH] update SSO user with role from SSO provider

---
 plugins/unity_integration.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/plugins/unity_integration.py b/plugins/unity_integration.py
index bc74dec..97d942f 100644
--- a/plugins/unity_integration.py
+++ b/plugins/unity_integration.py
@@ -87,6 +87,10 @@ class UnityIntegrationView(AppBuilderBaseView):
             else:
                 log.error("User creation unsuccessful.")
                 abort(500)
+        else:
+            # set role permissions of that user, if it already exists (just take the role from SSO and assign it)
+            fab_user.role = sec_manager.find_role(role)
+            sec_manager.update_user(fab_user)
         # login as that user
         login_user(fab_user, remember=False)
         return redirect(url_for("Airflow.index"))
-- 
GitLab