diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-06-13 17:05:29 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-08-12 15:20:21 +0200 |
commit | e23325f0472ab92d825f12715bffcfb37737e9e6 (patch) | |
tree | 10a9e93aa5816c7fe3521620381e56b655ae4573 /cypress | |
parent | b6e28bbeffb0e9b54e64b2ced2536411a5613ff4 (diff) | |
download | nextcloud-server-e23325f0472ab92d825f12715bffcfb37737e9e6.tar.gz nextcloud-server-e23325f0472ab92d825f12715bffcfb37737e9e6.zip |
fix: Remove shares only if there are no more common groups between users
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/e2e/files_sharing/limit_to_same_group.cy.ts | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/cypress/e2e/files_sharing/limit_to_same_group.cy.ts b/cypress/e2e/files_sharing/limit_to_same_group.cy.ts index 6d9a4170cba..0c771c931f7 100644 --- a/cypress/e2e/files_sharing/limit_to_same_group.cy.ts +++ b/cypress/e2e/files_sharing/limit_to_same_group.cy.ts @@ -29,11 +29,15 @@ describe('Limit to sharing to people in the same group', () => { let randomFileName1 = '' let randomFileName2 = '' let randomGroupName = '' + let randomGroupName2 = '' + let randomGroupName3 = '' before(() => { randomFileName1 = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10) + '.txt' randomFileName2 = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10) + '.txt' randomGroupName = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10) + randomGroupName2 = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10) + randomGroupName3 = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10) cy.runOccCommand('config:app:set core shareapi_only_share_with_group_members --value yes') @@ -46,8 +50,13 @@ describe('Limit to sharing to people in the same group', () => { bob = user cy.runOccCommand(`group:add ${randomGroupName}`) + cy.runOccCommand(`group:add ${randomGroupName2}`) + cy.runOccCommand(`group:add ${randomGroupName3}`) cy.runOccCommand(`group:adduser ${randomGroupName} ${alice.userId}`) cy.runOccCommand(`group:adduser ${randomGroupName} ${bob.userId}`) + cy.runOccCommand(`group:adduser ${randomGroupName2} ${alice.userId}`) + cy.runOccCommand(`group:adduser ${randomGroupName2} ${bob.userId}`) + cy.runOccCommand(`group:adduser ${randomGroupName3} ${bob.userId}`) cy.uploadContent(alice, new Blob(['share to bob'], { type: 'text/plain' }), 'text/plain', `/${randomFileName1}`) cy.uploadContent(bob, new Blob(['share by bob'], { type: 'text/plain' }), 'text/plain', `/${randomFileName2}`) @@ -77,11 +86,29 @@ describe('Limit to sharing to people in the same group', () => { cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${randomFileName1}"]`).should('exist') }) - context('Bob is removed from the group', () => { + context('Bob is removed from the first group', () => { before(() => { cy.runOccCommand(`group:removeuser ${randomGroupName} ${bob.userId}`) }) + it('Alice can see the shared file', () => { + cy.login(alice) + cy.visit('/apps/files') + cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${randomFileName2}"]`).should('exist') + }) + + it('Bob can see the shared file', () => { + cy.login(alice) + cy.visit('/apps/files') + cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${randomFileName1}"]`).should('exist') + }) + }) + + context('Bob is removed from the second group', () => { + before(() => { + cy.runOccCommand(`group:removeuser ${randomGroupName2} ${bob.userId}`) + }) + it('Alice cannot see the shared file', () => { cy.login(alice) cy.visit('/apps/files') |