mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
fix: Default collections created through MCP to private (#12644)
This commit is contained in:
@@ -1241,6 +1241,7 @@ describe("#collections.create", () => {
|
|||||||
expect(body.data.name).toBe("Test");
|
expect(body.data.name).toBe("Test");
|
||||||
expect(body.data.sort.field).toBe("index");
|
expect(body.data.sort.field).toBe("index");
|
||||||
expect(body.data.sort.direction).toBe("asc");
|
expect(body.data.sort.direction).toBe("asc");
|
||||||
|
expect(body.data.permission).toBe(null);
|
||||||
expect(body.policies.length).toBe(1);
|
expect(body.policies.length).toBe(1);
|
||||||
expect(body.policies[0].abilities.read).toBeTruthy();
|
expect(body.policies[0].abilities.read).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ describe("collection tools", () => {
|
|||||||
expect(data.color).toEqual("#FF0000");
|
expect(data.color).toEqual("#FF0000");
|
||||||
expect(data.id).toBeDefined();
|
expect(data.id).toBeDefined();
|
||||||
expect(data.url).toMatch(/^https?:\/\//);
|
expect(data.url).toMatch(/^https?:\/\//);
|
||||||
|
expect(data.permission).toEqual(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("update_collection updates fields on existing collection", async () => {
|
it("update_collection updates fields on existing collection", async () => {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { Sequelize, Op, type WhereOptions } from "sequelize";
|
import { Sequelize, Op, type WhereOptions } from "sequelize";
|
||||||
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||||
import { CollectionPermission } from "@shared/types";
|
|
||||||
import { Collection, Team } from "@server/models";
|
import { Collection, Team } from "@server/models";
|
||||||
import { sequelize } from "@server/storage/database";
|
import { sequelize } from "@server/storage/database";
|
||||||
import { authorize } from "@server/policies";
|
import { authorize } from "@server/policies";
|
||||||
@@ -179,7 +178,7 @@ export function collectionTools(server: McpServer, scopes: string[]) {
|
|||||||
color: input.color,
|
color: input.color,
|
||||||
teamId: user.teamId,
|
teamId: user.teamId,
|
||||||
createdById: user.id,
|
createdById: user.id,
|
||||||
permission: CollectionPermission.ReadWrite,
|
permission: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
await collection.saveWithCtx(ctx);
|
await collection.saveWithCtx(ctx);
|
||||||
|
|||||||
Reference in New Issue
Block a user