diff options
author | Ghostkeeper <rubend@tutanota.com> | 2021-10-18 14:17:22 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2021-10-18 14:17:22 +0300 |
commit | 5ed57e403c082d5d78c0f311c489b98368d974f6 (patch) | |
tree | 0ab9927163022fe6f99e35be7ba72f2d3adddb4f /plugins/VersionUpgrade | |
parent | bf6dd443b2daeb9b916b485539e099bcd861a397 (diff) |
Delete existing log-in information to force the user to log in again
Otherwise they won't be able to sync material profiles.
Contributes to issue CURA-8609.
Diffstat (limited to 'plugins/VersionUpgrade')
-rw-r--r-- | plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py b/plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py index 4fb18486c2..2ae94a11f7 100644 --- a/plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py +++ b/plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py @@ -3,6 +3,7 @@ import configparser import io +import json import os.path from typing import List, Tuple @@ -49,6 +50,28 @@ class VersionUpgrade411to412(VersionUpgrade): # Update version number. parser["metadata"]["setting_version"] = "19" + # If the account scope in 4.11 is outdated, delete it so that the user is enforced to log in again and get the + # correct permissions. + new_scopes = {"account.user.read", + "drive.backup.read", + "drive.backup.write", + "packages.download", + "packages.rating.read", + "packages.rating.write", + "connect.cluster.read", + "connect.cluster.write", + "library.project.read", + "library.project.write", + "cura.printjob.read", + "cura.printjob.write", + "cura.mesh.read", + "cura.mesh.write", + "cura.material.write"} + if "ultimaker_auth_data" in parser["general"]: + ultimaker_auth_data = json.loads(parser["general"]["ultimaker_auth_data"]) + if new_scopes - set(ultimaker_auth_data["scope"].split(" ")): + parser["general"]["ultimaker_auth_data"] = "{}" + result = io.StringIO() parser.write(result) return [filename], [result.getvalue()] |