Browse Source

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.
Ghostkeeper 2 years ago
parent
commit
19ba092340

+ 7 - 0
plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py

@@ -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."""

+ 7 - 0
plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py

@@ -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")