add option to disable link sharing (#27626)

* add option to remove link-sharing from backend

* restrict make link-sharing in the frontend based on capability

* extend e2e project-sharing tests to cover OVERLEAF_DISABLE_LINK_SHARING=true

* throw an error when link sharing is disabled in TokenAccessHandler

* throw errors when attempting to add users to projects with link sharing disabled

* Update server-ce/test/project-sharing.spec.ts

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* add tests for existing access when link sharing is disabled

* update tests to specify access restrictions for read-only and read-write link shared projects

* [web] block access to legacy public project with link-sharing disabled

---------

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: 5f194dbcb790e973e427c58a3a4a738a5dd74cb4
This commit is contained in:
Brian Gough
2025-08-20 08:05:33 +00:00
committed by Copybot
co-authored by Jakob Ackermann
parent 0138ae0dff
commit f5dbbadf79
18 changed files with 908 additions and 392 deletions
@@ -63,6 +63,7 @@ describe('AuthorizationManager', function () {
passwordStrengthOptions: {},
adminPrivilegeAvailable: true,
adminRolesEnabled: false,
moduleImportSequence: [],
}
this.AuthorizationManager = SandboxedModule.require(modulePath, {
requires: {
@@ -448,6 +449,28 @@ describe('AuthorizationManager', function () {
expect(this.result).to.equal('readAndWrite')
})
})
describe('with link-sharing disabled', function () {
beforeEach(async function () {
this.settings.disableLinkSharing = true
this.result =
await this.AuthorizationManager.promises.getPrivilegeLevelForProject(
null,
this.project._id,
this.token
)
})
it('should not call CollaboratorsGetter.getProjectAccess', function () {
this.CollaboratorsGetter.promises.getProjectAccess.called.should.equal(
false
)
})
it('should return false', function () {
expect(this.result).to.equal(false)
})
})
})
describe("when the project doesn't exist", function () {