Add user feature permissions and unified account management
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from __future__ import annotations
|
||||
from ..feature_guards import require_portal_access
|
||||
|
||||
import logging
|
||||
import re
|
||||
@@ -33,7 +34,7 @@ from ..services.issue_resolution import (
|
||||
from ..services.notifications import send_portal_notification
|
||||
from ..runtime import get_runtime_settings
|
||||
|
||||
router = APIRouter(prefix="/portal", tags=["portal"], dependencies=[Depends(get_current_user)])
|
||||
router = APIRouter(prefix="/portal", tags=["portal"], dependencies=[Depends(get_current_user), Depends(require_portal_access)])
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
PORTAL_KINDS = {"request", "issue", "feature"}
|
||||
@@ -654,10 +655,11 @@ async def _notify(
|
||||
|
||||
|
||||
@router.get("/overview")
|
||||
async def portal_overview(current_user: Dict[str, Any] = Depends(get_current_user)) -> Dict[str, Any]:
|
||||
mine = count_portal_items(mine_username=str(current_user.get("username") or ""))
|
||||
async def portal_overview(kind: Optional[str] = None, current_user: Dict[str, Any] = Depends(get_current_user)) -> Dict[str, Any]:
|
||||
kind = _normalize_choice(kind, field="kind", allowed=PORTAL_KINDS, allow_empty=True)
|
||||
mine = count_portal_items(kind=kind, mine_username=str(current_user.get("username") or ""))
|
||||
return {
|
||||
"overview": get_portal_overview(),
|
||||
"overview": get_portal_overview(kind) if kind else get_portal_overview(),
|
||||
"my_items": mine,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user