(params: BlockUserParams)
| 25 | * Also in the same transaction, through `revokeUserSessions`: revokes step-up |
| 26 | * proofs, denies pending or approved device auth requests, revokes device |
| 27 | * sessions with their unconsumed refresh tokens, deletes native attested keys, |
| 28 | * and deletes unconsumed app-shell hand-off tokens. |
| 29 | * |
| 30 | * @returns `true` if this call transitioned the user from unblocked to blocked, |
| 31 | * `false` if the user was already blocked (or does not exist). |
| 32 | */ |
| 33 | export async function blockUser(params: BlockUserParams): Promise<boolean> { |
| 34 | const executor = params.dbOrTx; |
| 35 | |
| 36 | async function run(tx: typeof db | DrizzleTransaction): Promise<boolean> { |
| 37 | const rows = await tx |
| 38 | .update(kilocode_users) |
| 39 | .set({ |
| 40 | blocked_reason: params.reason, |
| 41 | blocked_at: new Date().toISOString(), |
| 42 | blocked_by_kilo_user_id: params.blockedByKiloUserId ?? null, |
| 43 | api_token_pepper: randomUUID(), |
no test coverage detected