mirror of
https://github.com/lovasoa/whitebophir
synced 2024-11-10 06:24:17 +00:00
* remove logs
* new parsing of role line
This commit is contained in:
parent
81d0a87389
commit
7fff39eecd
1 changed files with 9 additions and 6 deletions
|
@ -59,14 +59,13 @@ function getBoardnamefromToken(token, boardNameIn) {
|
|||
var roles = payload.roles;
|
||||
var oneHasBoardName = false;
|
||||
var oneHasCorretBoardname = false;
|
||||
var regex = new RegExp( "(^[^\:]*\:)("+boardNameIn+"$)","gm");
|
||||
console.log(regex);
|
||||
if (roles) {
|
||||
for (var role of roles) {
|
||||
if (role.includes(':')) {
|
||||
for (var line of roles) {
|
||||
var role = parse_role(line);
|
||||
if (role.board_name !== '') {
|
||||
oneHasBoardName = true;
|
||||
}
|
||||
if (role.match(regex)) {
|
||||
if (role.board_name === boardNameIn) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -82,4 +81,8 @@ function getBoardnamefromToken(token, boardNameIn) {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = {checkBoardName};
|
||||
function parse_role(role) {
|
||||
let [_, role_name, board_name] = role.match(/^([^:]*):?(.*)$/);
|
||||
return {role_name, board_name}
|
||||
}
|
||||
module.exports = {checkBoardName, parse_role};
|
||||
|
|
Loading…
Reference in a new issue