DEFAULT_BETTER_AUTH_CREATOR_ROLE (organization/roles.ts)

polar · clients/adapters/better-auth/src/organization/roles.ts · typescript · Apache-2.0
auth, tag:embed-classified

Maps Better Auth roles to Polar organization roles for authentication adapters.

// Source: https://github.com/polarsource/polar | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import type { AuthContext } from 'better-auth'
import type {
  BetterAuthRoleMappingInput,
  BetterAuthRoleMappingOptions,
  PolarMemberRole,
} from './types'

export const DEFAULT_BETTER_AUTH_CREATOR_ROLE = 'owner'
const DEFAULT_BILLING_MANAGER_ROLES = ['admin'] as const

export const getBetterAuthOrganizationPlugin = (
  authContext: Pick<AuthContext, 'getPlugin'>,
) => authContext.getPlugin('organization')

export const getBetterAuthCreatorRole = (
  authContext: Pick<AuthContext, 'getPlugin'>,
): string =>
  getBetterAuthOrganizationPlugin(authContext)?.options.creatorRole ??
  DEFA

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key