You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
669 B
24 lines
669 B
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)
|
|
}
|
|
}
|
|
}
|