(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
This commit is contained in:
Paul Fitzpatrick 2021-04-23 15:32:44 -04:00
parent 65a722501d
commit ee3a8a2b85

View File

@ -1332,13 +1332,10 @@ export class GranularAccess implements GranularAccessForBundle {
const tableAccess = permInfo.getTableAccess(tableId); const tableAccess = permInfo.getTableAccess(tableId);
const access = accessCheck.get(tableAccess); const access = accessCheck.get(tableAccess);
if (access === 'allow') { return; } if (access === 'allow') { return; }
if (access === 'mixedColumns') { if (access === 'mixed') {
// Somewhat abusing prune method by calling it with an access function that // Deal with row-level access for the mixed condition.
// throws on denial. await this._checkRows(cursor, accessCheck);
this._pruneColumns(action, permInfo, tableId, accessCheck);
} }
// The remainder is the mixed condition.
await this._checkRows(cursor, accessCheck);
// Somewhat abusing prune method by calling it with an access function that // Somewhat abusing prune method by calling it with an access function that
// throws on denial. // throws on denial.
this._pruneColumns(action, permInfo, tableId, accessCheck); this._pruneColumns(action, permInfo, tableId, accessCheck);