Some checks failed
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Failing after 0s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 15s
Test Suite / playwright-tests (push) Has been cancelled
Test Suite / k6 /health Baseline (push) Has been cancelled
- Revised the status in the Capability Catalog to reflect partial implementation (M3). - Added a new reference to `MEMBERSHIP_RBAC_DECISIONS_2026-06.md` in both the Capability Catalog and Club Membership documentation. - Enhanced the Club Membership documentation with details on product decisions and onboarding phases. - Implemented middleware in the backend to restrict access for unverified users and those pending club membership. - Updated versioning in `version.py` to reflect changes in account lifecycle management.
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
/**
|
|
* Account-Lifecycle-Helfer (CAPABILITY_CATALOG §3, Phase A Onboarding).
|
|
*/
|
|
|
|
export function resolveAccountState(user) {
|
|
if (!user) return 'anonymous'
|
|
if (user.account_state) return user.account_state
|
|
const clubs = user.clubs || []
|
|
const hasActive = clubs.some(
|
|
(c) => String(c.membership_status || 'active').toLowerCase() === 'active'
|
|
)
|
|
if (hasActive) return 'active_member'
|
|
const verified =
|
|
user.email_verified === true ||
|
|
user.email_verified === 't' ||
|
|
user.email_verified === 1 ||
|
|
user.email_verified === 'true'
|
|
if (!verified) return 'unverified'
|
|
return 'verified_pending_club'
|
|
}
|
|
|
|
export function isPlatformAccountState(state) {
|
|
return state === 'platform_admin'
|
|
}
|
|
|
|
/** Eingeschränkter Modus: noch kein aktiver Vereinszugang bzw. E-Mail offen. */
|
|
export function isOnboardingRestricted(user) {
|
|
const state = resolveAccountState(user)
|
|
if (isPlatformAccountState(state)) return false
|
|
return state === 'verified_pending_club' || state === 'unverified'
|
|
}
|
|
|
|
const ONBOARDING_PATHS = ['/onboarding', '/settings', '/settings/legal', '/settings/system']
|
|
|
|
export function isOnboardingAllowedPath(pathname) {
|
|
const p = pathname || ''
|
|
return ONBOARDING_PATHS.some((base) => p === base || p.startsWith(`${base}/`))
|
|
}
|