Update Capability Catalog and Club Membership Documentation
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
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.
This commit is contained in:
1 parent
30dc30c7aa
commit
a2f60d3f46
12 files changed
+765
-15
No files matched your search
+23
-6
@@ -14,6 +14,7 @@ import { ToastProvider } from './context/ToastContext'
|
||||
import { OrgInboxProvider, useOrgInbox } from './context/OrgInboxContext'
|
||||
import DesktopSidebar from './components/DesktopSidebar'
|
||||
import { getMainNavItems } from './config/appNav'
|
||||
import { isOnboardingAllowedPath, isOnboardingRestricted } from './utils/accountState'
|
||||
import AdminHomeRedirect from './components/AdminHomeRedirect'
|
||||
import PlatformAdminRoute from './components/PlatformAdminRoute'
|
||||
import ActiveClubSwitcher from './components/ActiveClubSwitcher'
|
||||
@@ -21,6 +22,7 @@ import InactiveMembershipBanner from './components/InactiveMembershipBanner'
|
||||
import './app.css'
|
||||
|
||||
const LoginPage = lazy(() => import('./pages/LoginPage'))
|
||||
const OnboardingPage = lazy(() => import('./pages/OnboardingPage'))
|
||||
const VerifyPage = lazy(() => import('./pages/VerifyPage'))
|
||||
const Dashboard = lazy(() => import('./pages/Dashboard'))
|
||||
const AccountSettingsPage = lazy(() => import('./pages/AccountSettingsPage'))
|
||||
@@ -83,9 +85,12 @@ function AppRouteFallback() {
|
||||
}
|
||||
|
||||
// Bottom Navigation (Mobile)
|
||||
function Nav({ showAdminNav }) {
|
||||
function Nav({ showAdminNav, onboardingOnly }) {
|
||||
const { canAccessOrgInbox, inboxCount } = useOrgInbox()
|
||||
const items = getMainNavItems(showAdminNav, { showInbox: canAccessOrgInbox })
|
||||
const items = getMainNavItems(showAdminNav, {
|
||||
showInbox: canAccessOrgInbox,
|
||||
onboardingOnly,
|
||||
})
|
||||
const loc = useLocation()
|
||||
|
||||
const navItemActive = (pathname, item, routerIsActive) => {
|
||||
@@ -147,26 +152,37 @@ function ProtectedLayout() {
|
||||
return <Navigate to="/login" replace />
|
||||
}
|
||||
|
||||
const showAdminNav = computeShowAdminNav(user)
|
||||
const location = useLocation()
|
||||
const onboardingOnly = isOnboardingRestricted(user)
|
||||
if (onboardingOnly && !isOnboardingAllowedPath(location.pathname)) {
|
||||
return <Navigate to="/onboarding" replace />
|
||||
}
|
||||
|
||||
const showAdminNav = computeShowAdminNav(user) && !onboardingOnly
|
||||
|
||||
return (
|
||||
<OrgInboxProvider user={user}>
|
||||
<FormEditorActionsProvider>
|
||||
<DesktopSidebar showAdminNav={showAdminNav} user={user} onLogout={handleLogout} />
|
||||
<DesktopSidebar
|
||||
showAdminNav={showAdminNav}
|
||||
onboardingOnly={onboardingOnly}
|
||||
user={user}
|
||||
onLogout={handleLogout}
|
||||
/>
|
||||
<div className="app-shell">
|
||||
<div className="app-shell__column">
|
||||
<div className="app-header app-header--mobile app-header--mobile-stack">
|
||||
<div className="app-header-mobile__top">
|
||||
<div className="app-logo">🥋 Shinkan</div>
|
||||
</div>
|
||||
<ActiveClubSwitcher variant="mobile" />
|
||||
{!onboardingOnly ? <ActiveClubSwitcher variant="mobile" /> : null}
|
||||
</div>
|
||||
<div className="app-main">
|
||||
<InactiveMembershipBanner />
|
||||
<Outlet />
|
||||
</div>
|
||||
<FormEditorBottomSlot>
|
||||
<Nav showAdminNav={showAdminNav} />
|
||||
<Nav showAdminNav={showAdminNav} onboardingOnly={onboardingOnly} />
|
||||
</FormEditorBottomSlot>
|
||||
</div>
|
||||
</div>
|
||||
@@ -220,6 +236,7 @@ const appRouter = createBrowserRouter([
|
||||
element: <ProtectedLayout />,
|
||||
children: [
|
||||
{ index: true, element: <Dashboard /> },
|
||||
{ path: 'onboarding', element: <OnboardingPage /> },
|
||||
{ path: 'profile', element: <Navigate to="/settings" replace /> },
|
||||
{ path: 'settings', element: <AccountSettingsPage /> },
|
||||
{ path: 'settings/system', element: <SettingsSystemInfoPage /> },
|
||||
|
||||
@@ -14,12 +14,16 @@ function sidebarLinkActive(pathname, item, routerIsActive) {
|
||||
*/
|
||||
export default function DesktopSidebar({
|
||||
showAdminNav,
|
||||
onboardingOnly = false,
|
||||
user,
|
||||
onLogout
|
||||
}) {
|
||||
const loc = useLocation()
|
||||
const { canAccessOrgInbox, inboxCount } = useOrgInbox()
|
||||
const items = getMainNavItems(showAdminNav, { showInbox: canAccessOrgInbox })
|
||||
const items = getMainNavItems(showAdminNav, {
|
||||
showInbox: canAccessOrgInbox,
|
||||
onboardingOnly,
|
||||
})
|
||||
const tier = user?.tier || ''
|
||||
|
||||
return (
|
||||
|
||||
@@ -31,8 +31,19 @@ function baseItems(opts = {}) {
|
||||
return items
|
||||
}
|
||||
|
||||
/** @param {boolean} isAdmin @param {{ showInbox?: boolean }} opts */
|
||||
/** Nav für Onboarding (ohne Vereinsmitgliedschaft). */
|
||||
export function getOnboardingNavItems() {
|
||||
return [
|
||||
{ to: '/onboarding', label: 'Verein', shortLabel: 'Verein', end: true, Icon: Building2 },
|
||||
{ to: '/settings', label: 'Einstellungen', shortLabel: 'Einst.', Icon: Settings },
|
||||
]
|
||||
}
|
||||
|
||||
/** @param {boolean} isAdmin @param {{ showInbox?: boolean, onboardingOnly?: boolean }} opts */
|
||||
export function getMainNavItems(isAdmin, opts = {}) {
|
||||
if (opts.onboardingOnly) {
|
||||
return getOnboardingNavItems()
|
||||
}
|
||||
const showInbox = !!opts.showInbox
|
||||
const icons = [
|
||||
LayoutDashboard,
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import api from '../utils/api'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import EmailVerificationBanner from '../components/EmailVerificationBanner'
|
||||
import { resolveAccountState } from '../utils/accountState'
|
||||
|
||||
const joinStatusLabel = (s) =>
|
||||
({
|
||||
pending: 'ausstehend',
|
||||
accepted: 'angenommen',
|
||||
rejected: 'abgelehnt',
|
||||
withdrawn: 'zurückgezogen',
|
||||
})[s] || s
|
||||
|
||||
/**
|
||||
* Onboarding für Nutzer ohne aktive Vereinsmitgliedschaft (Phase A).
|
||||
*/
|
||||
export default function OnboardingPage() {
|
||||
const { user, checkAuth } = useAuth()
|
||||
const [publicClubs, setPublicClubs] = useState([])
|
||||
const [myJoinRequests, setMyJoinRequests] = useState([])
|
||||
const [joinClubId, setJoinClubId] = useState('')
|
||||
const [joinMessage, setJoinMessage] = useState('')
|
||||
const [joinBusy, setJoinBusy] = useState(false)
|
||||
const [error, setError] = useState('')
|
||||
const [ok, setOk] = useState('')
|
||||
|
||||
const accountState = resolveAccountState(user)
|
||||
const emailOk = accountState !== 'unverified'
|
||||
|
||||
const refreshJoinRequests = () => {
|
||||
if (!emailOk) return
|
||||
api.getMyClubJoinRequests().then(setMyJoinRequests).catch(() => {})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
api.listPublicClubsDirectory().then(setPublicClubs).catch(() => {})
|
||||
refreshJoinRequests()
|
||||
}, [user?.id, emailOk])
|
||||
|
||||
const memberClubIds = new Set((user?.clubs || []).map((c) => c.id))
|
||||
const pendingClubIds = new Set(
|
||||
myJoinRequests.filter((r) => r.status === 'pending').map((r) => r.club_id)
|
||||
)
|
||||
const joinClubChoices = publicClubs.filter(
|
||||
(c) => !memberClubIds.has(c.id) && !pendingClubIds.has(c.id)
|
||||
)
|
||||
|
||||
const handleJoin = async (e) => {
|
||||
e.preventDefault()
|
||||
setError('')
|
||||
setOk('')
|
||||
if (!joinClubId) {
|
||||
setError('Bitte einen Verein auswählen.')
|
||||
return
|
||||
}
|
||||
setJoinBusy(true)
|
||||
try {
|
||||
await api.createClubJoinRequest({
|
||||
club_id: parseInt(joinClubId, 10),
|
||||
message: (joinMessage || '').trim() || undefined,
|
||||
})
|
||||
setJoinMessage('')
|
||||
setJoinClubId('')
|
||||
refreshJoinRequests()
|
||||
await checkAuth()
|
||||
setOk('Antrag gesendet. Der Vereinsadmin kann ihn unter Vereinsverwaltung annehmen.')
|
||||
} catch (err) {
|
||||
setError(err.message || 'Antrag fehlgeschlagen.')
|
||||
} finally {
|
||||
setJoinBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="page-padding app-page" style={{ padding: '1rem', maxWidth: '40rem' }}>
|
||||
<h1 style={{ marginTop: 0, fontSize: '1.5rem' }}>Willkommen bei Shinkan</h1>
|
||||
<p style={{ color: 'var(--text2)', lineHeight: 1.5, marginBottom: '1.25rem' }}>
|
||||
Shinkan ist die Trainingsplanungs-Plattform für Vereine. Um Übungen, Planung und Medien zu nutzen,
|
||||
brauchst du eine Mitgliedschaft in einem Verein — oder du beantragst die Gründung eines neuen Vereins.
|
||||
</p>
|
||||
|
||||
<EmailVerificationBanner profile={user} />
|
||||
|
||||
{!emailOk ? (
|
||||
<div className="card">
|
||||
<p style={{ margin: 0, color: 'var(--text2)', lineHeight: 1.5 }}>
|
||||
Bitte bestätige zuerst deine E-Mail-Adresse. Danach kannst du einen Beitrittsantrag stellen.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{ok ? (
|
||||
<p role="status" style={{ color: 'var(--accent-dark)', marginBottom: '1rem' }}>
|
||||
{ok}
|
||||
</p>
|
||||
) : null}
|
||||
{error ? (
|
||||
<p role="alert" style={{ color: 'var(--danger)', marginBottom: '1rem' }}>
|
||||
{error}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
<div className="card" style={{ marginBottom: '1rem' }}>
|
||||
<h2 style={{ margin: '0 0 0.75rem', fontSize: '1.1rem' }}>Bestehendem Verein beitreten</h2>
|
||||
<p style={{ color: 'var(--text2)', fontSize: '0.875rem', marginBottom: '1rem', lineHeight: 1.5 }}>
|
||||
Wähle einen Verein und sende einen Beitrittsantrag. Nach Freigabe durch den Vereinsadmin
|
||||
stehen dir alle Funktionen zur Verfügung.
|
||||
</p>
|
||||
|
||||
{myJoinRequests.length > 0 ? (
|
||||
<div style={{ marginBottom: '1rem' }}>
|
||||
<strong style={{ fontSize: '0.9rem' }}>Meine Anträge</strong>
|
||||
<ul
|
||||
style={{
|
||||
margin: '0.5rem 0 0',
|
||||
paddingLeft: '1.25rem',
|
||||
color: 'var(--text2)',
|
||||
fontSize: '0.9rem',
|
||||
}}
|
||||
>
|
||||
{myJoinRequests.map((r) => (
|
||||
<li key={r.id} style={{ marginBottom: '0.35rem' }}>
|
||||
{r.club_name || `Verein #${r.club_id}`} — {joinStatusLabel(r.status)}
|
||||
{r.status === 'pending' ? (
|
||||
<>
|
||||
{' '}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
style={{ fontSize: '0.75rem', padding: '0.15rem 0.45rem' }}
|
||||
onClick={async () => {
|
||||
if (!confirm('Antrag wirklich zurückziehen?')) return
|
||||
try {
|
||||
await api.withdrawClubJoinRequest(r.id)
|
||||
refreshJoinRequests()
|
||||
} catch (err) {
|
||||
setError(err.message || 'Zurückziehen fehlgeschlagen.')
|
||||
}
|
||||
}}
|
||||
>
|
||||
zurückziehen
|
||||
</button>
|
||||
</>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<form onSubmit={handleJoin}>
|
||||
<label className="form-label" htmlFor="onb-join-club">
|
||||
Verein
|
||||
</label>
|
||||
<select
|
||||
id="onb-join-club"
|
||||
className="form-input"
|
||||
value={joinClubId}
|
||||
onChange={(e) => setJoinClubId(e.target.value)}
|
||||
>
|
||||
<option value="">—</option>
|
||||
{joinClubChoices.map((c) => (
|
||||
<option key={c.id} value={String(c.id)}>
|
||||
{c.name}
|
||||
{c.abbreviation ? ` (${c.abbreviation})` : ''}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<label className="form-label" htmlFor="onb-join-msg" style={{ marginTop: '0.75rem' }}>
|
||||
Nachricht (optional)
|
||||
</label>
|
||||
<textarea
|
||||
id="onb-join-msg"
|
||||
className="form-input"
|
||||
rows={2}
|
||||
value={joinMessage}
|
||||
onChange={(e) => setJoinMessage(e.target.value)}
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-primary"
|
||||
disabled={joinBusy}
|
||||
style={{ marginTop: '0.85rem' }}
|
||||
>
|
||||
{joinBusy ? 'Senden…' : 'Beitritt beantragen'}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div className="card">
|
||||
<h2 style={{ margin: '0 0 0.75rem', fontSize: '1.1rem' }}>Neuen Verein gründen</h2>
|
||||
<p style={{ color: 'var(--text2)', fontSize: '0.875rem', margin: 0, lineHeight: 1.5 }}>
|
||||
Die Beantragung einer neuen Vereinsgründung wird als Nächstes freigeschaltet (Freigabe durch
|
||||
den Plattform-Administrator). Bis dahin wende dich an{' '}
|
||||
<a href="mailto:support@jinkendo.de">support@jinkendo.de</a> oder tritt einem bestehenden Verein bei.
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
<p style={{ marginTop: '1.25rem', fontSize: '0.875rem' }}>
|
||||
<Link to="/settings">Einstellungen</Link> (Passwort, Profil)
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 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}/`))
|
||||
}
|
||||
Reference in new issue
Block a user