Redirect to USB workflow if user account doesn't have permissions

If the user is not allowed to write profiles to the printers, then they'd get errors when trying to sync. Instead we'll redirect them to the USB workflow.
This also works for users that have accounts but don't have the printers in the cloud. The original requirements suggest that the entire sync button must be hidden for this case. But to allow those people to still sync via USB I'm opting for this solution instead.

Contributes to issue CURA-9220.
This commit is contained in:
Ghostkeeper 2022-07-26 17:21:08 +02:00
parent 615f16bda0
commit 9d820b8d02
No known key found for this signature in database
GPG key ID: FFBC62A75981ED70

View file

@ -88,7 +88,15 @@ UM.Window
{
if(Cura.API.account.isLoggedIn)
{
swipeView.currentIndex += 2; //Skip sign in page.
if(Cura.API.account.permissions.includes("digital-factory.printer.write"))
{
swipeView.currentIndex += 2; //Skip sign in page. Continue to sync via cloud.
}
else
{
//Logged in, but no permissions to start syncing. Direct them to USB.
swipeView.currentIndex = removableDriveSyncPage.SwipeView.index;
}
}
else
{
@ -112,7 +120,15 @@ UM.Window
{
if(is_logged_in && signinPage.SwipeView.isCurrentItem)
{
swipeView.currentIndex += 1;
if(Cura.API.account.permissions.includes("digital-factory.printer.write"))
{
swipeView.currentIndex += 1;
}
else
{
//Logged in, but no permissions to start syncing. Direct them to USB.
swipeView.currentIndex = removableDriveSyncPage.SwipeView.index;
}
}
}
}