fix: Allow viewers with collection write access to import documents (#13707)

This commit is contained in:
Tom Moor authored and GitHub committed 2026-09-08 11:04:25 -04:00
1 parent c1811ffa20
commit 89a1da7ee6
2 files changed
+8 -5

No files matched your search

@@ -258,7 +258,7 @@ describe("#attachments.create", () => {
expect(attachment.expiresAt).toBeTruthy();
});
it("should not allow viewer to upload using import preset", async () => {
it("should allow viewer to upload using import preset", async () => {
const user = await buildViewer();
const res = await server.post("/api/attachments.create", user, {
body: {
@@ -268,7 +268,13 @@ describe("#attachments.create", () => {
preset: AttachmentPreset.Import,
},
});
expect(res.status).toEqual(403);
expect(res.status).toEqual(200);
const body = await res.json();
const attachment = await Attachment.findByPk(body.data.attachment.id, {
rejectOnEmpty: true,
});
expect(attachment.expiresAt).toBeTruthy();
});
it("should not allow attachment creation for other documents", async () => {
@@ -106,9 +106,6 @@ router.post(
if (preset === AttachmentPreset.WorkspaceImport) {
authorize(user, "createImport", user.team);
}
if (preset === AttachmentPreset.Import) {
authorize(user, "createDocument", user.team);
}
if (preset === AttachmentPreset.Emoji) {
assertIn(contentType, AttachmentValidation.emojiContentTypes);
}