From 986f4699655d0a5763e08bf97f168c5f26b7c408 Mon Sep 17 00:00:00 2001 From: Dmitry S Date: Fri, 18 Sep 2020 12:41:52 -0400 Subject: [PATCH] (core) Support "Public access" switch in the UI for docs. Summary: - The older "Anonymous access" option is renamed to "Public access" in the UI. - This option was only present with GRIST_SUPPORT_ANON set. - With GRIST_SUPPORT_ANON, the old behavior is kept: "Public access" option adds/removes anon@ user - Without GRIST_SUPPORT_ANON (normal case), orgs/workspaces don't support "Public access" option. For documents, it adds/removes everyone@ user. The latter is the main feature of interest. The GRIST_SUPPORT_ANON flag is set for on-premise installs, and adds discoverability by anon users. Test Plan: Added a test cases and checks in other tests. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2612 --- app/common/UserAPI.ts | 3 +++ app/gen-server/lib/HomeDBManager.ts | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/common/UserAPI.ts b/app/common/UserAPI.ts index 54fd2749..ac56aa7e 100644 --- a/app/common/UserAPI.ts +++ b/app/common/UserAPI.ts @@ -15,6 +15,9 @@ import {addCurrentOrgToPath} from 'app/common/urlUtils'; // Nominal email address of the anonymous user. export const ANONYMOUS_USER_EMAIL = 'anon@getgrist.com'; +// Nominal email address of a user who, if you share with them, everyone gets access. +export const EVERYONE_EMAIL = 'everyone@getgrist.com'; + // A special user allowed to add/remove the EVERYONE_EMAIL to/from a resource. export const SUPPORT_EMAIL = 'support@getgrist.com'; diff --git a/app/gen-server/lib/HomeDBManager.ts b/app/gen-server/lib/HomeDBManager.ts index c29fec23..ca8eafa9 100644 --- a/app/gen-server/lib/HomeDBManager.ts +++ b/app/gen-server/lib/HomeDBManager.ts @@ -7,7 +7,8 @@ import {FullUser, UserProfile} from 'app/common/LoginSessionAPI'; import {checkSubdomainValidity} from 'app/common/orgNameUtils'; import * as roles from 'app/common/roles'; // TODO: API should implement UserAPI -import {ANONYMOUS_USER_EMAIL, DocumentProperties, ManagerDelta, NEW_DOCUMENT_CODE, Organization as OrgInfo, +import {ANONYMOUS_USER_EMAIL, DocumentProperties, EVERYONE_EMAIL, + ManagerDelta, NEW_DOCUMENT_CODE, Organization as OrgInfo, OrganizationProperties, PermissionData, PermissionDelta, SUPPORT_EMAIL, UserAccessData, WorkspaceProperties} from "app/common/UserAPI"; import {AclRule, AclRuleDoc, AclRuleOrg, AclRuleWs} from "app/gen-server/entity/AclRule"; @@ -44,9 +45,6 @@ applyPatch(); // Nominal email address of a user who can view anything (for thumbnails). export const PREVIEWER_EMAIL = 'thumbnail@getgrist.com'; -// Nominal email address of a user who, if you share with them, everyone gets access. -export const EVERYONE_EMAIL = 'everyone@getgrist.com'; - // A list of emails we don't expect to see logins for. const NON_LOGIN_EMAILS = [PREVIEWER_EMAIL, EVERYONE_EMAIL, ANONYMOUS_USER_EMAIL];