(core) Remove UI-imposed restriction against combining public edit access and access rules

Test Plan: TBD

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3272
This commit is contained in:
Dmitry S
2022-02-16 16:40:42 -05:00
parent 8d34b70899
commit 9855a145d1
2 changed files with 2 additions and 27 deletions

View File

@@ -1,7 +1,6 @@
import {GristDoc} from 'app/client/components/GristDoc';
import {AppModel} from 'app/client/models/AppModel';
import {DocPageModel} from 'app/client/models/DocPageModel';
import {reportWarning} from 'app/client/models/errors';
import {ShareAnnotations, ShareAnnotator} from 'app/common/ShareAnnotator';
import {normalizeEmail} from 'app/common/emails';
import {GristLoadConfig} from 'app/common/gristUrls';
@@ -255,13 +254,7 @@ export class UserManagerModelImpl extends Disposable implements UserManagerModel
}
// Loop through the members and update the delta.
for (const m of members) {
let access = m.access.get();
if (m === this.publicMember && access === roles.EDITOR && this.gristDoc?.hasGranularAccessRules()) {
access = roles.VIEWER;
if (!options?.silent) {
reportWarning('Public "Editor" access is incompatible with Access Rules. Reduced to "Viewer".');
}
}
const access = m.access.get();
if (!roles.isValidRole(access)) {
if (!options?.silent) {
throw new Error(`Cannot update user to invalid role ${access}`);