mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Only show certain App Switcher icons when account has DF access
Added a dictionary where additional user rights can be set. A plugin such as the DigitalFactory can update this dictionary if certain account rights change. The `account.additionalRights` is intended to allow us some flexibility, without breaking the API in the future. The Application Switcher now queries the additional account rights, which is updated by the DF plugin to only show `My printers`, `Digital Library` and `Print jobs` when the user has access to the DF. Contributes to CURA-8624
This commit is contained in:
parent
629f695ef7
commit
666880ad20
3 changed files with 31 additions and 14 deletions
|
@ -67,10 +67,12 @@ class DigitalFactoryApiClient:
|
|||
def callbackWrap(response: Optional[Any] = None, *args, **kwargs) -> None:
|
||||
if (response is not None and isinstance(response, DigitalFactoryFeatureBudgetResponse) and
|
||||
response.library_max_private_projects is not None):
|
||||
callback(
|
||||
response.library_max_private_projects == -1 or # Note: -1 is unlimited
|
||||
response.library_max_private_projects > 0)
|
||||
# A user has DF access when library_max_private_projects is either -1 (unlimited) or bigger then 0
|
||||
has_access = response.library_max_private_projects == -1 or response.library_max_private_projects > 0
|
||||
callback(has_access)
|
||||
self._library_max_private_projects = response.library_max_private_projects
|
||||
# update the account with the additional user rights
|
||||
self._account.updateAdditionalRight(df_access = has_access)
|
||||
else:
|
||||
Logger.warning(f"Digital Factory: Response is not a feature budget, likely an error: {str(response)}")
|
||||
callback(False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue