fix: Update document policy to disable sharing for read-only users (#1638)

* fix: Update document policy to disable sharing for read-only users

* test: Update test for new permission logic
This commit is contained in:
Tom Moor
2020-11-10 20:35:41 -08:00
committed by GitHub
parent 5e7bbdc111
commit 26e6db1afd
2 changed files with 8 additions and 24 deletions

View File

@@ -149,9 +149,10 @@ describe("#shares.create", () => {
expect(body.data.documentTitle).toBe(document.title);
});
it("should allow creating a share record for document in read-only collection", async () => {
it("should not allow creating a share record with read-only permissions", async () => {
const { user, document, collection } = await seed();
collection.private = true;
await collection.save();
await CollectionUser.create({
@@ -164,11 +165,7 @@ describe("#shares.create", () => {
const res = await server.post("/api/shares.create", {
body: { token: user.getJwtToken(), documentId: document.id },
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.published).toBe(false);
expect(body.data.documentTitle).toBe(document.title);
expect(res.status).toEqual(403);
});
it("should allow creating a share record if link previously revoked", async () => {