Add property of whether the printer details can be read

We'd assume so, but there is a permissions node for it. If it can't be read by the user, they can't navigate to the printer's overview page. So we should hide the button then.

Contributes to issue CURA-9220.
This commit is contained in:
Ghostkeeper 2022-07-26 16:56:19 +02:00
parent e9f9730364
commit 19ba092340
No known key found for this signature in database
GPG Key ID: FFBC62A75981ED70
2 changed files with 14 additions and 0 deletions

View File

@ -366,6 +366,13 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
""" """
return "digital-factory.print-job.write.own" in self._account.permissions return "digital-factory.print-job.write.own" in self._account.permissions
@pyqtProperty(bool, constant = True)
def canReadPrinterDetails(self) -> bool:
"""
Whether this user can read the status of the printer.
"""
return "digital-factory.printer.read" in self._account.permissions
@property @property
def clusterData(self) -> CloudClusterResponse: def clusterData(self) -> CloudClusterResponse:
"""Gets the cluster response from which this device was created.""" """Gets the cluster response from which this device was created."""

View File

@ -213,6 +213,13 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice):
""" """
return True return True
@pyqtProperty(bool, constant = True)
def canReadPrinterDetails(self) -> bool:
"""
Whether this user can read the status of the printer.
"""
return True
@pyqtSlot(name="openPrintJobControlPanel") @pyqtSlot(name="openPrintJobControlPanel")
def openPrintJobControlPanel(self) -> None: def openPrintJobControlPanel(self) -> None:
raise NotImplementedError("openPrintJobControlPanel must be implemented") raise NotImplementedError("openPrintJobControlPanel must be implemented")