mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
1937043aed
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
24 lines
666 B
TypeScript
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
|
|
)
|
|
);
|