diff --git a/scripts/index.js b/scripts/index.js index ade5049..233d2f1 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -26,6 +26,15 @@ Hooks.on("init", () => { type: String, default: 'h1' }); + game.settings.register(MODULE_NAME, 'minPermission', { + name : 'Minimum permission', + hint: 'A user needs at least this permission level on the destination for a link to be visible.', + scope: 'world', + config: true, + type: String, + choices: Object.keys(CONST.DOCUMENT_PERMISSION_LEVELS), + default: 'LIMITED' + }); game.settings.register(MODULE_NAME, 'debug', { name : 'Debug logging', scope: 'client', diff --git a/scripts/journallink.js b/scripts/journallink.js index bdff937..0fea283 100755 --- a/scripts/journallink.js +++ b/scripts/journallink.js @@ -163,6 +163,8 @@ export class JournalLink { for (let value of values) { let mappedType = this.entityMap[type]; let entity = game[mappedType].get(value); + if (!entity.testUserPermission(game.users.current, game.settings.get('journal-links', 'minPermission'))) + continue; this.debug('adding link from ' + type + ' ' + entity.name); let link = $(''); link.attr('data-entity', type);