diff options
author | Remco Burema <41987080+rburema@users.noreply.github.com> | 2021-04-09 10:48:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 10:48:55 +0300 |
commit | 7f6133ca9475eb48163b97aad3b87957190f3a8a (patch) | |
tree | 315f65b4533c835618e1fa3de93e0f58ee6c80bc /plugins/VersionUpgrade | |
parent | dbef89ea89fea187689887a9dcddd3205685568b (diff) | |
parent | dca0612ee766ae7e62a03c9158538d88399954ca (diff) |
Merge pull request #9535 from Ultimaker/CURA-8093_Check_client_scope_when_upgrading_from_4.8
CURA-8093: Check client scope when upgrading from 4.8
Diffstat (limited to 'plugins/VersionUpgrade')
-rw-r--r-- | plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py b/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py index 5ce3cb724f..4595e66ed3 100644 --- a/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py +++ b/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py @@ -4,8 +4,10 @@ import configparser from typing import Tuple, List import io +import json from UM.VersionUpgrade import VersionUpgrade +from cura.API import Account class VersionUpgrade48to49(VersionUpgrade): @@ -32,6 +34,13 @@ class VersionUpgrade48to49(VersionUpgrade): if "categories_expanded" in parser["cura"] and any([setting in parser["cura"]["categories_expanded"] for setting in self._moved_visibility_settings]): parser["cura"]["categories_expanded"] += ";top_bottom" + # If the account scope in 4.8 is outdated, delete it so that the user is enforced to log in again and get the + # correct permissions. + if "ultimaker_auth_data" in parser["general"]: + ultimaker_auth_data = json.loads(parser["general"]["ultimaker_auth_data"]) + if set(Account.CLIENT_SCOPES.split(" ")) - set(ultimaker_auth_data["scope"].split(" ")): + parser["general"]["ultimaker_auth_data"] = "{}" + result = io.StringIO() parser.write(result) return [filename], [result.getvalue()] |