mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) make AccessRules and FullCopies effective
Summary: This allows `*SPECIAL:AccessRules` to give read access to the access rules to more users, and `*SPECIAL:FullCopies` to grant download/copy rights to more users. This diff also changes forks to be owned by the user who forked them (previously they were an editor), since that feels more natural. Test Plan: Added and updated tests. Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2760
This commit is contained in:
@@ -57,7 +57,11 @@ export class ACLUsersPopup extends Disposable {
|
||||
public async init(pageModel: DocPageModel) {
|
||||
this._currentUser = pageModel.userOverride.get()?.user || pageModel.appModel.currentValidUser;
|
||||
const doc = pageModel.currentDoc.get();
|
||||
if (doc) {
|
||||
// Disabling "View as user" for forks for the moment. The getDocAccess endpoint
|
||||
// only succeeds for documents that exist in the DB currently.
|
||||
// TODO: modify the getDocAccess endpoint to accept forks, through the kind of
|
||||
// manipulation that getDoc does. Then we can enable this button for forks.
|
||||
if (doc && !doc.isFork) {
|
||||
const permissionData = await pageModel.appModel.api.getDocAccess(doc.id);
|
||||
if (this.isDisposed()) { return; }
|
||||
this._usersInDoc = permissionData.users.map(user => ({
|
||||
|
||||
@@ -318,9 +318,10 @@ export class AccessRules extends Disposable {
|
||||
),
|
||||
),
|
||||
bigBasicButton('Add User Attributes', dom.on('click', () => this._addUserAttributes())),
|
||||
bigBasicButton('Users', cssDropdownIcon('Dropdown'), elem => this._aclUsersPopup.attachPopup(elem),
|
||||
dom.style('visibility', use => use(this._aclUsersPopup.isInitialized) ? '' : 'hidden'),
|
||||
),
|
||||
!this._gristDoc.docPageModel.isFork.get() ?
|
||||
bigBasicButton('Users', cssDropdownIcon('Dropdown'), elem => this._aclUsersPopup.attachPopup(elem),
|
||||
dom.style('visibility', use => use(this._aclUsersPopup.isInitialized) ? '' : 'hidden'),
|
||||
) : null,
|
||||
),
|
||||
cssConditionError(dom.text(this._errorMessage), {style: 'margin-left: 16px'},
|
||||
testId('access-rules-error')
|
||||
|
||||
Reference in New Issue
Block a user