Browse Source

components/if-permitted: Added not option.

1.1
Gisle Aune 6 years ago
parent
commit
1e022d6116
  1. 7
      marko/components/if-permitted/component.js

7
marko/components/if-permitted/component.js

@ -7,7 +7,7 @@ module.exports = class {
onInput(input) {
if (!input.user || !input.user.loggedIn) {
this.state.permitted = false
this.state.permitted = input.not
return
}
@ -18,5 +18,10 @@ module.exports = class {
} else {
this.state.permitted = input.user.permissions.includes(input.permission)
}
// Flip the above permission
if (input.not) {
this.state.permitted = !this.state.permitted
}
}
}
Loading…
Cancel
Save