index.ts
1export const input = z.object({
2 email: z.string().email().describe("Who is leaving"),
3});
4type Input = z.infer<typeof input>;
5
6export default async function run({ email }: Input) {
7 // **Find their manager**
8 // From their IdP profile; stop if there isn't one
9 const manager = await risotto.get_manager({ email });
10 if (!manager) {
11 fail(`No manager on file for ${email}.`);
12 }
13
14 // **Lock their accounts**
15 // End Okta sessions, then suspend Google Workspace
16 await tools.okta.revoke_okta_user_sessions({
17 email_address: email,
18 });
19 await tools.google.set_google_workspace_user_suspension({
20 email_address: email,
21 action: "suspend",
22 });
23 await tools.google.sign_out_google_workspace_user({
24 email_address: email,
25 });