Put all the relevant privacy helpers into their own module
This commit is contained in:
parent
8b488f488b
commit
f2f742e65a
2 changed files with 20 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ import { TableCreator } from "./Apps/TableCreator.mjs";
|
||||||
import { TestApp } from "./Apps/TestApp.mjs";
|
import { TestApp } from "./Apps/TestApp.mjs";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { filterPrivateRows } from "./utils/filterPrivateRows.mjs";
|
import { filterPrivateRows } from "./utils/privacy.mjs";
|
||||||
import { validateValue } from "./utils/validateValue.mjs";
|
import { validateValue } from "./utils/validateValue.mjs";
|
||||||
|
|
||||||
const { deepFreeze } = foundry.utils;
|
const { deepFreeze } = foundry.utils;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,22 @@
|
||||||
|
export const PrivacyMode = Object.freeze({
|
||||||
|
GM: `gm`,
|
||||||
|
PRIVATE: `private`,
|
||||||
|
SELF: `self`,
|
||||||
|
PUBLIC: `public`,
|
||||||
|
});
|
||||||
|
|
||||||
|
export function determinePrivacyFromRollMode(rollMode) {
|
||||||
|
switch (rollMode) {
|
||||||
|
case CONST.DICE_ROLL_MODES.BLIND:
|
||||||
|
return PrivacyMode.GM;
|
||||||
|
case CONST.DICE_ROLL_MODES.PRIVATE:
|
||||||
|
return PrivacyMode.PRIVATE;
|
||||||
|
case CONST.DICE_ROLL_MODES.SELF:
|
||||||
|
return PrivacyMode.SELF;
|
||||||
|
}
|
||||||
|
return PrivacyMode.PUBLIC;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters an array of database rows based on if the current user would
|
* Filters an array of database rows based on if the current user would
|
||||||
* be able to see them based on the privacy level.
|
* be able to see them based on the privacy level.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue