mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) alert user if they try to use rec in a column rule controlling read permission
Summary: This particular combination of features is not built out - data will be censored but changes to data will not. So the user will now get an error if they try to do it. Existing rules of this kind will continue to operate as before, and can be set via the api. Test Plan: added test Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2751
This commit is contained in:
@@ -30,6 +30,7 @@ import {toTableDataAction} from 'app/common/DocActions';
|
||||
import {DocData} from 'app/common/DocData';
|
||||
import {DocSnapshots} from 'app/common/DocSnapshot';
|
||||
import {EncActionBundleFromHub} from 'app/common/EncActionBundle';
|
||||
import {FormulaProperties, getFormulaProperties} from 'app/common/GranularAccessClause';
|
||||
import {byteString, countIf} from 'app/common/gutil';
|
||||
import {InactivityTimer} from 'app/common/InactivityTimer';
|
||||
import * as marshal from 'app/common/marshal';
|
||||
@@ -933,15 +934,16 @@ export class ActiveDoc extends EventEmitter {
|
||||
/**
|
||||
* Check if an ACL formula is valid. If not, will throw an error with an explanation.
|
||||
*/
|
||||
public async checkAclFormula(docSession: DocSession, text: string): Promise<void> {
|
||||
public async checkAclFormula(docSession: DocSession, text: string): Promise<FormulaProperties> {
|
||||
// Checks can leak names of tables and columns.
|
||||
if (await this._granularAccess.hasNuancedAccess(docSession)) { return; }
|
||||
if (await this._granularAccess.hasNuancedAccess(docSession)) { return {}; }
|
||||
await this.waitForInitialization();
|
||||
try {
|
||||
const parsedAclFormula = await this._pyCall('parse_acl_formula', text);
|
||||
compileAclFormula(parsedAclFormula);
|
||||
// TODO We also need to check the validity of attributes, and of tables and columns
|
||||
// mentioned in resources and userAttribute rules.
|
||||
return getFormulaProperties(parsedAclFormula);
|
||||
} catch (e) {
|
||||
e.message = e.message?.replace('[Sandbox] ', '');
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user