|
1 | 1 | import { db } from '@sim/db' |
2 | 2 | import { member, organization } from '@sim/db/schema' |
3 | 3 | import { createLogger } from '@sim/logger' |
4 | | -import { eq, sql } from 'drizzle-orm' |
| 4 | +import { eq } from 'drizzle-orm' |
5 | 5 |
|
6 | 6 | const logger = createLogger('SecurityPolicy') |
7 | 7 |
|
@@ -125,25 +125,6 @@ export async function getMemberOrganizationId( |
125 | 125 | } |
126 | 126 | } |
127 | 127 |
|
128 | | -/** |
129 | | - * Atomically bumps the org's security-policy version and drops the local |
130 | | - * cache entry. Every member's cached session cookie is invalidated on its |
131 | | - * next request (version mismatch → DB session read), which is what makes |
132 | | - * policy changes and org-wide revocation take effect within the cache TTL |
133 | | - * instead of the 24h cookie-cache lifetime. |
134 | | - * |
135 | | - * Callers that already write the `organization` row in the same request |
136 | | - * should fold `securityPolicyVersion: sql`...` + 1` into that UPDATE and call |
137 | | - * {@link invalidateSecurityPolicyVersionCache} instead. |
138 | | - */ |
139 | | -export async function bumpSecurityPolicyVersion(organizationId: string): Promise<void> { |
140 | | - await db |
141 | | - .update(organization) |
142 | | - .set({ securityPolicyVersion: sql`${organization.securityPolicyVersion} + 1` }) |
143 | | - .where(eq(organization.id, organizationId)) |
144 | | - invalidateSecurityPolicyVersionCache(organizationId) |
145 | | -} |
146 | | - |
147 | 128 | /** |
148 | 129 | * Cookie-cache version for a session, consumed by Better Auth's |
149 | 130 | * `session.cookieCache.version`. Embeds the member org's security-policy |
|
0 commit comments