Files
documenso/packages/lib/server-only/user/is-user-enterprise.ts
Ephraim Atta-Duncan 43810c4357 feat: document 2fa
2025-07-22 14:08:03 +00:00

15 lines
500 B
TypeScript

import { getOrganisationClaimByUserId } from '../organisation/get-organisation-claims';
/**
* Check if a user has enterprise features enabled (cfr21 flag).
*/
export const isUserEnterprise = async ({ userId }: { userId: number }): Promise<boolean> => {
try {
const organisationClaim = await getOrganisationClaimByUserId({ userId });
return Boolean(organisationClaim.flags.cfr21);
} catch {
// If we can't find the organisation claim, assume non-enterprise
return false;
}
};