diff options
author | geireann <60007097+geireann@users.noreply.github.com> | 2020-10-02 20:52:10 +0800 |
---|---|---|
committer | geireann <60007097+geireann@users.noreply.github.com> | 2020-10-02 20:52:10 +0800 |
commit | 805bf106c85f693f6e6d15c06cacd5e16079c707 (patch) | |
tree | 872f84dee5ffcae04fbfe128941c0429f3aee562 /src/fields/util.ts | |
parent | 3b14058df2cf9cb444836a6b1fea92835eb51761 (diff) | |
parent | 1dee63242684f02543cf7667b53baa00d10ab6c1 (diff) |
Merge branch 'master' into presentation_v1
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..4da9fce74 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(/\./g, '__'); +} +export function denormalizeEmail(email: string) { + return email.replace(/__/g, '.'); +} + // 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; |