Skip to content

Commit 383a9c2

Browse files
committed
support sso only in QGIS 3.40 and never
1 parent 339305b commit 383a9c2

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Mergin/configuration_dialog.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from qgis.PyQt import uic
88
from qgis.PyQt.QtCore import Qt, QSettings, QTimer
99
from qgis.PyQt.QtGui import QPixmap
10-
from qgis.core import QgsApplication
10+
from qgis.core import QgsApplication, Qgis
1111
from urllib.error import URLError
1212

1313

@@ -25,6 +25,7 @@
2525
sso_ask_for_email,
2626
mergin_server_deprecated_version,
2727
url_reachable,
28+
qgis_support_sso,
2829
)
2930
from .utils import (
3031
MERGIN_URL,
@@ -90,6 +91,11 @@ def __init__(self):
9091
self.check_credentials()
9192
self.check_sso_availability()
9293

94+
if not qgis_support_sso():
95+
self.ui.button_sign_sso.setVisible(False)
96+
self.ui.stacked_widget_login.setCurrentIndex(0)
97+
self.ui.sso_email.setVisible(False)
98+
9399
def accept(self):
94100
if not self.test_connection():
95101
return
@@ -181,6 +187,9 @@ def test_connection(self):
181187
def allow_sso_login(self) -> None:
182188
self.ui.button_sign_sso.setVisible(False)
183189

190+
if not qgis_support_sso():
191+
return
192+
184193
allowed, msg = sso_login_allowed(self.server_url())
185194
if msg:
186195
QMessageBox.critical(self, "SSO allowed check", msg)

Mergin/utils_auth.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
QgsBlockingNetworkRequest,
1414
QgsNetworkAccessManager,
1515
QgsExpressionContextUtils,
16+
Qgis,
1617
)
1718
from qgis.PyQt.QtCore import QSettings, QUrl
1819
from qgis.PyQt.QtNetwork import QNetworkRequest
@@ -523,3 +524,12 @@ def url_reachable(url: str) -> bool:
523524
except (requests.RequestException, urllib3.exceptions.LocationParseError):
524525
return False
525526
return True
527+
528+
529+
def qgis_support_sso() -> bool:
530+
"""
531+
Check if the current QGIS version supports SSO login.
532+
Returns True if SSO is supported, False otherwise.
533+
"""
534+
# QGIS 3.40+ supports SSO
535+
return Qgis.versionInt() >= 34000

0 commit comments

Comments
 (0)