mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) flesh out "View As" feature
Summary: The users shown by the "View As" button are now drawn from more sources: * There are users the document is shared with. This has been rationalized, the behavior was somewhat erratic. If the user is not an owner of the document, the only user of this kind that will be listed is themselves. * There are users mentioned in any user attribute table keyed by Email. If name and access columns are present, those are respected, otherwise name is taken from email and access is set to "editors". * There are example users provided if there are not many other users available. Test Plan: added and extended tests Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3045
This commit is contained in:
@@ -2,6 +2,7 @@ import {ActionGroup} from 'app/common/ActionGroup';
|
||||
import {CellValue, TableDataAction, UserAction} from 'app/common/DocActions';
|
||||
import {FormulaProperties} from 'app/common/GranularAccessClause';
|
||||
import {FetchUrlOptions, UploadResult} from 'app/common/uploads';
|
||||
import {PermissionData, UserAccessData} from 'app/common/UserAPI';
|
||||
import {ParseOptions} from 'app/plugin/FileParserAPI';
|
||||
import {IMessage} from 'grain-rpc';
|
||||
|
||||
@@ -134,6 +135,16 @@ export interface ForkResult {
|
||||
urlId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension of PermissionData to cover not just users with whom a document is shared,
|
||||
* but also users mentioned in the document (in user attribute tables), and suggested
|
||||
* example users. This is for use in the "View As" feature of the access rules page.
|
||||
*/
|
||||
export interface PermissionDataWithExtraUsers extends PermissionData {
|
||||
attributeTableUsers: UserAccessData[];
|
||||
exampleUsers: UserAccessData[];
|
||||
}
|
||||
|
||||
export interface ActiveDocAPI {
|
||||
/**
|
||||
* Closes a document, and unsubscribes from its userAction events.
|
||||
@@ -277,4 +288,9 @@ export interface ActiveDocAPI {
|
||||
* Wait for document to finish initializing.
|
||||
*/
|
||||
waitForInitialization(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Get users that are worth proposing to "View As" for access control purposes.
|
||||
*/
|
||||
getUsersForViewAs(): Promise<PermissionDataWithExtraUsers>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user