mirror of
https://github.com/outline/outline.git
synced 2026-11-29 16:40:27 +03:00
20 lines
629 B
TypeScript
20 lines
629 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))
|
|
);
|