Commit e39d2b1d authored by Dimitrios Gogos's avatar Dimitrios Gogos
Browse files

feat: remove account_url from CurrentUser type and update related components

parent cd7baf59
Loading
Loading
Loading
Loading
Loading
+2 −14
Changes for portal-gui/src/features/profile/profile.tsx: 2 added lines, 14 removed lines.
Original line number Diff line number Diff line
import type { ReactNode } from 'react';
import { CheckIcon, ExternalLinkIcon } from 'lucide-react';
import { CheckIcon } from 'lucide-react';

import { PageContent } from '@/components/common/page-content';
import { PageHeader } from '@/components/common/page-header';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import {
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from '@/components/ui/card';
@@ -103,8 +101,7 @@ export function ProfilePage() {
            <CardHeader>
              <CardTitle>Account</CardTitle>
              <CardDescription>
                Your name, email and password are managed in your OpenOP
                account.
                Your account details. Ask an administrator to change them.
              </CardDescription>
            </CardHeader>

@@ -130,15 +127,6 @@ export function ProfilePage() {
                </Field>
              </dl>
            </CardContent>

            <CardFooter>
              <Button asChild variant="outline">
                <a href={user.account_url} target="_blank" rel="noreferrer">
                  Manage account
                  <ExternalLinkIcon />
                </a>
              </Button>
            </CardFooter>
          </Card>

          <Card>
+0 −1
Changes for portal-gui/src/types/authentication.ts: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ export type CurrentUser = {
  organization: string | null;
  // The token's API scopes (CAMARA), without the OpenID Connect ones.
  scopes: string[];
  account_url: string;
};

export type LogoutResponse = {
+0 −2
Changes for src/portal_service/api/auth/schemas.py: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@ class CurrentUser(BaseModel):
    roles: list[str] = []
    organization: str | None = None
    scopes: list[str] = []
    account_url: str

    @classmethod
    def from_claims(cls, claims: TokenClaims) -> "CurrentUser":
@@ -24,7 +23,6 @@ class CurrentUser(BaseModel):
            roles=sorted(claims.roles),
            organization=claims.organization,
            scopes=sorted(claims.api_scopes),
            account_url=f"{claims.iss}/account",
        )


+0 −2
Changes for tests/unit/test_me_route.py: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ from fastapi.testclient import TestClient
from portal_service.api.dependencies import get_identity_provider, get_login_session_repo
from portal_service.application.session_crypto import SessionCredentials, encrypt_tokens
from portal_service.domain.models import LoginSession, SessionTokens
from tests.conftest import ISSUER
from tests.fakes import FakeIdentityProvider, FakeLoginSessionRepository

SESSION_COOKIE = "oop_session"
@@ -91,7 +90,6 @@ def test_answers_with_the_user_behind_the_cookie(
        "organization": "dev-org",
        # Only the API scopes, sorted; the OpenID Connect ones are left out.
        "scopes": ["location-retrieval:read", "qod-sessions-read"],
        "account_url": f"{ISSUER}/account",
    }