From ee3a8a2b853790fbdbc43758126c4add7047f70d Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Fri, 23 Apr 2021 15:32:44 -0400 Subject: [PATCH] (core) streamline mixedColumns case of granular access control Summary: This removes some unintentional repetition of work when there are no row-level rules (there was a missing `return`). Test Plan: existing tests pass Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2782 --- app/server/lib/GranularAccess.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/server/lib/GranularAccess.ts b/app/server/lib/GranularAccess.ts index d2462d24..1ebe33f4 100644 --- a/app/server/lib/GranularAccess.ts +++ b/app/server/lib/GranularAccess.ts @@ -1332,13 +1332,10 @@ export class GranularAccess implements GranularAccessForBundle { const tableAccess = permInfo.getTableAccess(tableId); const access = accessCheck.get(tableAccess); if (access === 'allow') { return; } - if (access === 'mixedColumns') { - // Somewhat abusing prune method by calling it with an access function that - // throws on denial. - this._pruneColumns(action, permInfo, tableId, accessCheck); + if (access === 'mixed') { + // Deal with row-level access for the mixed condition. + await this._checkRows(cursor, accessCheck); } - // The remainder is the mixed condition. - await this._checkRows(cursor, accessCheck); // Somewhat abusing prune method by calling it with an access function that // throws on denial. this._pruneColumns(action, permInfo, tableId, accessCheck);