diff options
author | bobzel <zzzman@gmail.com> | 2020-10-01 10:15:26 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-10-01 10:15:26 -0400 |
commit | df25be868115b378e208fc729b75d606be279164 (patch) | |
tree | 1796c3cbbac17fd21cc08de2f679011b4960ad4c /src/fields/util.ts | |
parent | 852ddf70b7ed3d027eb5cb8415df4df77b8652a6 (diff) |
changed sharing to use __ to replace .'s in emails to avoid problems with storing keys in mongo
Diffstat (limited to 'src/fields/util.ts')
-rw-r--r-- | src/fields/util.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts index f0ff2dad4..6c92aef81 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -116,6 +116,13 @@ export function OVERRIDE_acl(val: boolean) { _overrideAcl = val; } +export function normalizeEmail(email: string) { + return email.replace('.', '__'); +} +export function denormalizeEmail(email: string) { + return email.replace('__', '.'); +} + // playground mode allows the user to add/delete documents or make layout changes without them saving to the server // let playgroundMode = false; @@ -184,7 +191,7 @@ export function GetEffectiveAcl(target: any, in_prop?: string | symbol | number, for (const [key, value] of Object.entries(target[AclSym])) { // there are issues with storing fields with . in the name, so they are replaced with _ during creation // as a result we need to restore them again during this comparison. - const entity = key.substring(4).replace('_', '.'); // an individual or a group + const entity = denormalizeEmail(key.substring(4)); // an individual or a group if (currentUserGroups.includes(entity) || userChecked === entity) { if (HierarchyMapping.get(value as symbol)! > HierarchyMapping.get(effectiveAcl)!) { effectiveAcl = value as symbol; |