(core) allow non-owners to remove themselves from sites/workspaces/docs

Summary:
For users who cannot otherwise change access to a resource, let
them remove themselves. Implemented via the standard endpoints
as a special exception that will process a request from a user
that would otherwise be denied, if the only contents of that
request are a removal of themselves.

Users who can change access are still not permitted to change their
own permissions or to remove themselves, as a precaution against
orphaning resources.

Test Plan: extended and updated tests

Reviewers: cyprien

Reviewed By: cyprien

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3367
This commit is contained in:
Paul Fitzpatrick
2022-04-12 15:31:41 -04:00
parent 25e40bfa9b
commit 20dd2fc70d
10 changed files with 165 additions and 48 deletions

View File

@@ -1222,9 +1222,22 @@ export async function editOrgAcls(): Promise<void> {
await driver.findWait('.test-um-members', 3000);
}
export async function saveAcls(): Promise<void> {
/**
* Click confirm on a user manager dialog. If clickRemove is set, then
* any extra modal that pops up will be accepted. Returns true unless
* clickRemove was set and no modal popped up.
*/
export async function saveAcls(clickRemove: boolean = false): Promise<boolean> {
await driver.findWait('.test-um-confirm', 3000).click();
await driver.wait(async () => !(await driver.find('.test-um-members').isPresent()), 3000);
let clickedRemove: boolean = false;
await driver.wait(async () => {
if (clickRemove && !clickedRemove && await driver.find('.test-modal-confirm').isPresent()) {
await driver.find('.test-modal-confirm').click();
clickedRemove = true;
}
return !(await driver.find('.test-um-members').isPresent());
}, 3000);
return clickedRemove || !clickRemove;
}
/**