Files
Tom Moor 1937043aed feat: MCP Server (#11464)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 20:14:18 -05:00

24 lines
666 B
TypeScript

import { Team, User, OAuthClient } from "@server/models";
import { allow } from "./cancan";
import { or, isTeamModel, isTeamMutable, and, isTeamAdmin } from "./utils";
allow(User, "createOAuthClient", Team, (actor, team) =>
and(isTeamAdmin(actor, team), isTeamMutable(actor))
);
allow(User, "listOAuthClients", Team, (actor, team) =>
isTeamAdmin(actor, team)
);
allow(User, "read", OAuthClient, (actor, oauthClient) =>
or(isTeamModel(actor, oauthClient), !!oauthClient?.published)
);
allow(User, ["update", "delete"], OAuthClient, (actor, oauthClient) =>
and(
isTeamAdmin(actor, oauthClient),
isTeamMutable(actor),
!oauthClient?.isDCR
)
);