mirror of
https://github.com/documenso/documenso.git
synced 2025-11-16 17:51:49 +10:00
feat: document 2fa
This commit is contained in:
14
packages/lib/server-only/user/is-user-enterprise.ts
Normal file
14
packages/lib/server-only/user/is-user-enterprise.ts
Normal file
@ -0,0 +1,14 @@
|
||||
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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user