(anct) fetch and display organization names of communes

ANCT-specific extraction of organization names for communes, front
end changes to match.
This commit is contained in:
Laurent Bossavit
2024-12-05 15:44:30 +01:00
committed by Laurent Bossavit
parent d495ef3e19
commit 20cc173e93
10 changed files with 93 additions and 22 deletions

View File

@@ -9,6 +9,7 @@ export interface User {
id: string;
email: string;
name?: string;
organization?: Organization;
abilities?: {
mailboxes: UserAbilities;
contacts: UserAbilities;
@@ -16,6 +17,12 @@ export interface User {
};
}
export interface Organization {
id: string;
name: string;
registration_id_list: [string];
}
export type UserAbilities = {
can_view?: boolean;
can_create?: boolean;

View File

@@ -14,7 +14,12 @@ export const AccountDropdown = () => {
<DropButton
button={
<Box $flex $direction="row" $align="center">
<Text $theme="primary">{userName}</Text>
<Box $flex $direction="column" $align="left">
<Text $theme="primary">{userName}</Text>
{userData?.organization?.registration_id_list?.at(0) && (
<Text $theme="primary">{userData?.organization?.name}</Text>
)}
</Box>
<Text className="material-icons" $theme="primary" aria-hidden="true">
arrow_drop_down
</Text>

View File

@@ -9,9 +9,6 @@ test.beforeEach(async ({ page, browserName }) => {
test.describe('OIDC interop with SIRET', () => {
test('it checks the SIRET is displayed in /me endpoint', async ({ page }) => {
const header = page.locator('header').first();
await expect(header.getByAltText('Marianne Logo')).toBeVisible();
const response = await page.request.get(
'http://localhost:8071/api/v1.0/users/me/',
);
@@ -21,3 +18,16 @@ test.describe('OIDC interop with SIRET', () => {
});
});
});
test.describe('When a commune, display commune name below user name', () => {
test('it checks the name is added below the user name', async ({ page }) => {
const header = page.locator('header').first();
await expect(header.getByAltText('Marianne Logo')).toBeVisible();
const logout = page.getByRole('button', {
name: 'Marie Delamairie',
});
await expect(logout.getByText('Varzy')).toBeVisible();
});
});