Skip to content

Commit

Permalink
add a setting for a minimum permission requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
jtracey committed Apr 4, 2022
1 parent c7accb8 commit 395fa5c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions scripts/journallink.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = $('<a class="entity-link content-link" draggable="true"></a>');
link.attr('data-entity', type);
Expand Down

0 comments on commit 395fa5c

Please sign in to comment.