diff --git a/app/client/aclui/ACLFormulaEditor.ts b/app/client/aclui/ACLFormulaEditor.ts index 02c299cc..330e8c9e 100644 --- a/app/client/aclui/ACLFormulaEditor.ts +++ b/app/client/aclui/ACLFormulaEditor.ts @@ -47,7 +47,7 @@ export function aclFormulaEditor(options: ACLFormulaOptions) { // Some grist-specific constants: 'OWNER', 'EDITOR', 'VIEWER', // The common variables. - 'user', 'rec', + 'user', 'rec', 'newRec', // Other completions that depend on doc schema or other rules. ...options.getSuggestions(prefix), ]; diff --git a/app/client/aclui/AccessRules.ts b/app/client/aclui/AccessRules.ts index a3647fc6..bb8ba1b1 100644 --- a/app/client/aclui/AccessRules.ts +++ b/app/client/aclui/AccessRules.ts @@ -1091,6 +1091,7 @@ class ObsRulePart extends Disposable { private _completions = Computed.create(this, (use) => [ ...use(this._ruleSet.accessRules.userAttrChoices).map(opt => opt.label), ...this._ruleSet.getValidColIds().map(colId => `rec.${colId}`), + ...this._ruleSet.getValidColIds().map(colId => `newRec.${colId}`), ]); // The permission bits. diff --git a/sandbox/grist/acl_formula.py b/sandbox/grist/acl_formula.py index 77c6f466..29ed80c2 100644 --- a/sandbox/grist/acl_formula.py +++ b/sandbox/grist/acl_formula.py @@ -131,7 +131,7 @@ class _EntityCollector(_TreeConverter): parent = self.visit(node.value) # We recognize a couple of specific patterns for entities that may be affected by renames. - if parent == ['Name', 'rec']: + if parent == ['Name', 'rec'] or parent == ['Name', 'newRec']: # rec.COL refers to the column from the table that the rule is on. self.entities.append(NamedEntity('recCol', node.last_token.startpos, node.attr, None)) if parent == ['Name', 'user']: diff --git a/test/nbrowser/gristUtils.ts b/test/nbrowser/gristUtils.ts index d3989ffe..773b7e4f 100644 --- a/test/nbrowser/gristUtils.ts +++ b/test/nbrowser/gristUtils.ts @@ -1139,6 +1139,12 @@ export async function getTestState(): Promise { return state || {}; } +// Get the full text from an element containing an Ace editor. +export async function getAceText(el: WebElement): Promise { + return driver.executeScript('return ace.edit(arguments[0]).getValue()', + el.find('.ace_editor')); +} + // All users ('user1', etc.) that can be logged in using Session.user(). export enum TestUserEnum { user1 = 'chimpy',