Always check permission settings in localstorage.

pull/1/head
Grandschtroumpf 6 years ago
parent 2c936e319f
commit 71a8f92296
  1. 7
      src/persmission-handler.js

@ -39,8 +39,12 @@ function notAllowWarning (from, to) {
export class PermissionHandler { export class PermissionHandler {
constructor () { constructor () {
this.permissions = this._getFromLocal()
}
_getFromLocal() {
const permission = localStorage.getItem('plugins/permissions') const permission = localStorage.getItem('plugins/permissions')
this.permissions = permission ? JSON.parse(permission) : {} return permission ? JSON.parse(permission) : {}
} }
persistPermissions () { persistPermissions () {
@ -101,6 +105,7 @@ export class PermissionHandler {
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
async askPermission (from, to) { async askPermission (from, to) {
this.permissions = this._getFromLocal()
if (!this.permissions[to.name]) this.permissions[to.name] = {} if (!this.permissions[to.name]) this.permissions[to.name] = {}
if (!this.permissions[to.name][from.name]) return this.openPermission(from, to) if (!this.permissions[to.name][from.name]) return this.openPermission(from, to)

Loading…
Cancel
Save