Skip to content

Commit

Permalink
SetDisplayFormula may be involved. That's one scary UserAction.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfitz committed Jul 18, 2024
1 parent 7abd6d4 commit 2c7af80
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/server/lib/GranularAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ export class GranularAccess implements GranularAccessForBundle {
// Don't need to apply this particular check.
return;
}
await this._assertOnlyBundledWithSimpleDataActions(COPY_OR_CONVERT_COLUMN_ACTIONS, actions);
await this._assertOnlyBundledWithSimpleDataActions(COPY_OR_CONVERT_COLUMN_ACTIONS, actions, ['SetDisplayFormula']);
await this._onlyRegularTablesWithFullTableAccess(docSession, actions, isCopyOrConvertColumnAction);
}

Expand All @@ -1413,10 +1413,14 @@ export class GranularAccess implements GranularAccessForBundle {
}

/**
* Asserts that `actionNames` (if present in `actions`) are only bundled with simple data actions.
* Asserts that `actionNames` (if present in `actions`) are only bundled with simple data actions (or extraActions).
*/
private async _assertOnlyBundledWithSimpleDataActions(actionNames: string | string[], actions: UserAction[]) {
const names = Array.isArray(actionNames) ? actionNames : [actionNames];
private async _assertOnlyBundledWithSimpleDataActions(actionNames: string | string[], actions: UserAction[],
extraActions?: string[]) {
const names = [
...Array.isArray(actionNames) ? actionNames : [actionNames],
...extraActions ?? [],
];
// Fail if being combined with anything that isn't a simple data action.
await applyToActionsRecursively(actions, async (a) => {
const name = String(a[0]);
Expand Down

0 comments on commit 2c7af80

Please sign in to comment.