🚑 Prevent Read Only user to send emergency stop

This commit is contained in:
SebClem 2020-08-17 13:05:24 +02:00
parent e80ec6916f
commit fe22cb57c9

View File

@ -43,16 +43,21 @@ $(function () {
};
this.hasControlPermition = function () {
let user = this.loginState.currentUser()
return user.permissions.includes("control") || user.needs.role.includes("control");
}
this.big_button_visible = function () {
return this.loginState.isUser() && this.settings.big_button();
return this.loginState.isUser() && this.settings.big_button() && this.hasControlPermition();
};
this.little_button_visible = function () {
return this.loginState.isUser() && !this.settings.big_button();
return this.loginState.isUser() && !this.settings.big_button() && this.hasControlPermition();
};
this.can_send_command = function () {
return this.loginState.isUser() && this.printerState.isOperational();
return this.loginState.isUser() && this.hasControlPermition() && this.printerState.isOperational() ;
};
this.little_button_css = function () {