module.exports = class { onCreate() { this.state = { permitted: false } } onInput(input) { console.log(input.user, input.permission) if (!input.user || !input.user.loggedIn) { this.state.permitted = false return } if (input.author != null && input.author != "" && input.user.name === input.author) { this.state.permitted = input.user.permissions.includes("member") } else if (Array.isArray(input.permission)) { this.state.permitted = input.user.permissions.find(p => input.permission.includes(p)) } else { this.state.permitted = input.user.permissions.includes(input.permission) } } }