Fixed power control access on web pages.

Ylian Saint-Hilaire committed Dec 14, 2021 at 15:09 UTC aa6b0ec6fe9d96698dd08a55e23c76148565dfa8
2 files changed +8 -8
views/default-mobile.handlebars
+4 -4
@@ -3522,15 +3522,15 @@
3522 x += '<input type=button value="' + "Notes" + '" onclick=showNotes(' + ((meshrights & 128) == 0) + ',"' + encodeURIComponent(node._id) + '") />';
3523 //if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += '<input type=button value=Toast onclick=deviceToastFunction() />'; }
3524
3525 - if ((node.mtype == 4) && (meshrights & 8) && (connectivity & 1)) {
3525 + if ((node.mtype == 4) && (connectivity & 1)) {
3526 if (node.porttype == 'PDU') {
3527 if (node.pwr == 1) {
3528 - x += '<input type=button value="' + "Turn off" + '" title="' + "Turn off" + '" onclick=setIpPduState(0) />';
3528 + if (meshrights & 0x40000) { x += '<input type=button value="' + "Turn off" + '" title="' + "Turn off" + '" onclick=setIpPduState(0) />'; }
3529 } else if (node.pwr == 8) {
3530 - x += '<input type=button value="' + "Turn on" + '" title="' + "Turn on" + '" onclick=setIpPduState(1) />';
3530 + if (meshrights & 0x40) { x += '<input type=button value="' + "Turn on" + '" title="' + "Turn on" + '" onclick=setIpPduState(1) />'; }
3531 }
3532 } else {
3533 - x += '<input type=button value="' + "Remote Control" + '" title="' + "Remote Control" + '" onclick=openIpKvmRemoteControl("' + encodeURIComponentEx(node._id) + '") />';
3533 + if (meshrights & 8) { x += '<input type=button value="' + "Remote Control" + '" title="' + "Remote Control" + '" onclick=openIpKvmRemoteControl("' + encodeURIComponentEx(node._id) + '") />'; }x
3534 }
3535 }
3536
views/default.handlebars
+4 -4
@@ -6902,15 +6902,15 @@
6902 QV('DeskGuestShareButton', false);
6903 }
6904 }
6905 - if ((node.mtype == 4) && (meshrights & 8) && (connectivity & 1)) {
6905 + if ((node.mtype == 4) && (connectivity & 1)) {
6906 if (node.porttype == 'PDU') {
6907 if (node.pwr == 1) {
6908 - x += '<input type=button value="' + "Turn off" + '" title="' + "Turn off" + '" onclick=setIpPduState(0) />';
6908 + if (meshrights & 0x40000) { x += '<input type=button value="' + "Turn off" + '" title="' + "Turn off" + '" onclick=setIpPduState(0) />'; }
6909 } else if (node.pwr == 8) {
6910 - x += '<input type=button value="' + "Turn on" + '" title="' + "Turn on" + '" onclick=setIpPduState(1) />';
6910 + if (meshrights & 0x40) { x += '<input type=button value="' + "Turn on" + '" title="' + "Turn on" + '" onclick=setIpPduState(1) />'; }
6911 }
6912 } else {
6913 - x += '<input type=button value="' + "Remote Control" + '" title="' + "Remote Control" + '" onclick=openIpKvmRemoteControl("' + encodeURIComponentEx(node._id) + '") />';
6913 + if (meshrights & 8) { x += '<input type=button value="' + "Remote Control" + '" title="' + "Remote Control" + '" onclick=openIpKvmRemoteControl("' + encodeURIComponentEx(node._id) + '") />'; }
6914 }
6915 }
6916