🚑 Check if permissions is defined for octoprint version < 1.4.0 #16

This commit is contained in:
Sebastien Clement 2020-11-23 11:40:57 +01:00
parent 30b486a4f0
commit 55ac690469

View File

@ -44,9 +44,13 @@ $(function () {
};
this.hasControlPermition = function () {
let user = this.loginState.currentUser()
let user = this.loginState.currentUser();
if(user.permissions !== undefined){
return user.permissions.includes("control") || user.needs.role.includes("control");
}
else return true;
}
this.big_button_visible = function () {
return this.loginState.isUser() && this.settings.big_button() && this.hasControlPermition();