Only request permissions when token changed

Since the permissions can only change with a token, we only need to
check what the permissions at that moment (instead of every 60 seconds)
Fixes CURA-11870
This commit is contained in:
Jaime van Kessel 2024-06-10 13:26:22 +02:00
parent 59771d0ddc
commit 7f7dbd6b1a
No known key found for this signature in database
GPG key ID: C85F7A3AF1BAA7C4

View file

@ -115,15 +115,15 @@ class Account(QObject):
self._update_timer.setSingleShot(True)
self._update_timer.timeout.connect(self.sync)
self._sync_services: Dict[str, int] = {}
"""contains entries "service_name" : SyncState"""
self.syncRequested.connect(self._updatePermissions)
self._sync_services: Dict[str, int] = {}
def initialize(self) -> None:
self._authorization_service.initialize(self._application.getPreferences())
self._authorization_service.onAuthStateChanged.connect(self._onLoginStateChanged)
self._authorization_service.onAuthenticationError.connect(self._onLoginStateChanged)
self._authorization_service.accessTokenChanged.connect(self._onAccessTokenChanged)
self._authorization_service.accessTokenChanged.connect(self._updatePermissions)
self._authorization_service.loadAuthDataFromPreferences()
@pyqtProperty(int, notify=syncStateChanged)