Merge pull request #260 from H2-invent/bugfix/whipe_board

bugfix whipe board with new role function.
This commit is contained in:
Ophir LOJKINE 2022-10-17 00:03:53 +02:00 committed by GitHub
commit 0071ebacbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,7 @@ var fs = require("./fs_promises.js"),
path = require("path"),
config = require("./configuration.js"),
Mutex = require("async-mutex").Mutex,
jwtauth = require("./jwtauth.js");
jwtauth = require("./jwtBoardnameAuth.js");
/**
* Represents a board.
@ -174,7 +174,7 @@ class BoardData {
this.addChild(message.parent, message);
break;
case "clear":
if(jwtauth.checkIfModerator(message.token)) {
if(jwtauth.roleInBoard(message.token,message.board) === 'moderator') {
this.clear();
} else {
throw new Error("User is not a moderator");