Skip to content

Commit d1f43f0

Browse files
committed
chore(session-policy): drop dead bumpSecurityPolicyVersion helper — call sites bump transactionally
1 parent c0061f3 commit d1f43f0

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

apps/sim/lib/auth/security-policy.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { db } from '@sim/db'
22
import { member, organization } from '@sim/db/schema'
33
import { createLogger } from '@sim/logger'
4-
import { eq, sql } from 'drizzle-orm'
4+
import { eq } from 'drizzle-orm'
55

66
const logger = createLogger('SecurityPolicy')
77

@@ -125,25 +125,6 @@ export async function getMemberOrganizationId(
125125
}
126126
}
127127

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-
147128
/**
148129
* Cookie-cache version for a session, consumed by Better Auth's
149130
* `session.cookieCache.version`. Embeds the member org's security-policy

0 commit comments

Comments
 (0)