mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Disallow the combination of Public Edit access and granular ACLs.
Summary: - When Public Edit access is enabled, Access Rules page shows a warning and prevents saving rules. - When any ACL rules are present, attempts to set Public access to Editor role get downgraded to Viewer role, with a warning notification. - No checks are made on the server side, so the combination may be achieved via the API (but we may block it in the future). Test Plan: Added a test case. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2767
This commit is contained in:
@@ -522,6 +522,14 @@ export class GristDoc extends DisposableWithEvents {
|
||||
});
|
||||
}
|
||||
|
||||
public hasGranularAccessRules(): boolean {
|
||||
const rulesTable = this.docData.getTable('_grist_ACLRules')!;
|
||||
// To check if there are rules, ignore the default no-op rule created for an older incarnation
|
||||
// of ACLs. It exists in older documents, and is still created for new ones. We detect it by
|
||||
// the use of the deprecated 'permissions' field, and not the new 'permissionsText' field.
|
||||
return rulesTable.numRecords() > rulesTable.filterRowIds({permissionsText: '', permissions: 63}).length;
|
||||
}
|
||||
|
||||
private _getToolContent(tool: typeof RightPanelTool.type): IExtraTool|null {
|
||||
switch (tool) {
|
||||
case 'docHistory': {
|
||||
|
||||
Reference in New Issue
Block a user