mirror of
https://github.com/outline/outline.git
synced 2026-11-28 08:14:58 +03:00
fix: Allow viewers with collection write access to import documents (#13707)
This commit is contained in:
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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user