Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/amui/1101 unhappy flow ikke alle rettigheter delegert #1137

Merged
552 changes: 12 additions & 540 deletions .mock/handlers.js

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions .mock/handlers/apiDelegation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { http, HttpResponse } from 'msw';

export const apiDelegationHandlers = (ACCESSMANAGEMENT_BASE_URL: string) => [
http.get(ACCESSMANAGEMENT_BASE_URL + '/apidelegation/:id/:type', () => {
return HttpResponse.json([
{
id: 'LIVLIG DYREBAR TIGER AS',
name: 'LIVLIG DYREBAR TIGER AS',
orgNumber: '313357120',
apiList: [],
},
{
id: 'MAGISK FANTASTISK KATT AS',
name: 'MAGISK FANTASTISK KATT AS',
orgNumber: '123456789',
apiList: [],
},
{
id: 'EVENTYR SKOGEN AS',
name: 'EVENTYR SKOGEN AS',
orgNumber: '987654321',
apiList: [],
},
{
id: 'STORSLATT HAV AS',
name: 'STORSLATT HAV AS',
orgNumber: '112233445',
apiList: [],
},
]);
}),
http.post(`${ACCESSMANAGEMENT_BASE_URL}/apidelegation/:id/received/revoke/batch`, () => {
return HttpResponse.json([
{
orgNumber: '313357120',
apiId: 'digdir-maskinportenschemaid-302',
success: true,
},
{
orgNumber: '313357120',
apiId: 'digdir-maskinportenschemaid-302',
success: false,
},
]);
}),
http.post(ACCESSMANAGEMENT_BASE_URL + '/apidelegation/:id/offered/revoke/batch', () => {
return HttpResponse.json([
{
orgNumber: '313357120',
apiId: 'digdir-maskinportenschemaid-302',
success: true,
},
{
orgNumber: '313357120',
apiId: 'digdir-maskinportenschemaid-302',
success: false,
},
]);
}),
http.post(`${ACCESSMANAGEMENT_BASE_URL}/apidelegation/:id/delegationcheck`, ({ params }) => {
return HttpResponse.json([
{
rightKey: 'appid-136:ScopeAccess',
resource: [
{
id: 'urn:altinn:resource',
value: 'appid-136',
},
],
action: 'ScopeAccess',
status: 'NotDelegable',
details: [
{
code: 'MissingRoleAccess',
description:
'The user does not have any required role(s) for the reportee party. (urn:altinn:rolecode:HADM, urn:altinn:location:garage), would give access to delegate the service.',
parameters: {
roleRequirementsMatches: [
{
id: 'urn:altinn:role',
value: 'DAGL',
},
],
},
},
],
},
]);
}),
];
42 changes: 42 additions & 0 deletions .mock/handlers/lookup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { http, HttpResponse } from 'msw';

export const lookupHandlers = (ACCESSMANAGEMENT_BASE_URL: string) => [
http.get(`${ACCESSMANAGEMENT_BASE_URL}/lookup/org/:id`, () => {
return HttpResponse.json({
orgNumber: '991825827',
name: 'Digitaliseringsdirektoratet',
});
}),
http.get(`${ACCESSMANAGEMENT_BASE_URL}/lookup/party`, () => {
return HttpResponse.json({
partyId: 51329012,
partyUuid: 'cd35779b-b174-4ecc-bbef-ece13611be7f',
partyTypeName: 2,
orgNumber: '310202398',
ssn: '',
unitType: 'AS',
name: 'DISKRET NÆR TIGER AS',
isDeleted: false,
onlyHierarchyElementWithNoAccess: false,
person: null,
organization: {
orgNumber: '310202398',
name: 'DISKRET NÆR TIGER AS',
unitType: 'AS',
telephoneNumber: '12345678',
mobileNumber: '92010000',
faxNumber: '92110000',
eMailAddress: '[email protected]',
internetAddress: 'http://vikesaa.no',
mailingAddress: 'Medalje Gate 1',
mailingPostalCode: '0170',
mailingPostalCity: 'Oslo',
businessAddress: 'Medalje Gate 1',
businessPostalCode: '0170',
businessPostalCity: 'By',
unitStatus: null,
},
childParties: null,
});
}),
];
146 changes: 146 additions & 0 deletions .mock/handlers/resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import { http, HttpResponse } from 'msw';

export const resourceHandler = (ACCESSMANAGEMENT_BASE_URL: string) => [
http.get(ACCESSMANAGEMENT_BASE_URL + '/resources/search', () => {
return HttpResponse.json({
page: 1,
numEntriesTotal: 2,
pageList: [
{
identifier: 'appid-502',
title: 'Det magiske klesskapet - lenketjeneste',
description: 'Det magiske klesskapet',
rightDescription: 'Gir tilgang til Narnia.',
homepage: null,
status: null,
spatial: null,
contactPoints: [
{
category: 'Some category',
email: '[email protected]',
telephone: '12345678',
contactPage: 'Some page (webpage maybe?)',
},
],
delegable: true,
visible: true,
resourceOwnerName: 'NARNIA',
resourceOwnerOrgNumber: '777777777',
resourceReferences: [
{
ReferenceSource: 'Altinn3',
Reference: 'ttd/a3-app',
ReferenceType: 'ApplicationId',
},
],
priorityCounter: 2,
resourceType: 'Default',
authorizationReference: [
{
id: 'urn:altinn:resource',
value: 'appid-502',
},
],
keywords: ['klesskapet_kw'],
},
{
identifier: 'appid-503',
title: 'Snarveien - lenketjeneste',
description: 'Snarveien som lenketjeneste',
rightDescription: 'Gir tilgang til snarveier.',
resourceOwnerName: 'Snarveien',
homepage: null,
status: null,
spatial: null,
contactPoints: [
{
category: 'Some category',
email: '[email protected]',
telephone: '12345678',
contactPage: 'Some page (webpage maybe?)',
},
],
delegable: true,
},
{
identifier: 'missing_role_access',
title: 'Krever Rolle',
description: 'Denne ressursen krever spesifikke roller for tilgang.',
rightDescription: 'Denne ressursen krever spesifikke roller for tilgang.',
delegable: true,
resourceOwnerName: 'Manglende Rolle',
authorizationReference: [
{
id: 'urn:altinn:resource',
value: 'missing_role_access',
},
],
},
{
identifier: 'missing_right_access',
title: 'Krever Rettighet',
description: 'Denne ressursen krever spesifikke rettigheter for tilgang.',
rightDescription: 'Denne ressursen krever spesifikke rettigheter for tilgang.',
delegable: true,
resourceOwnerName: 'Manglende Rettigheter',
authorizationReference: [
{
id: 'urn:altinn:resource',
value: 'missing_right_access',
},
],
},
{
identifier: 'missing_srr_rightAccess',
title: 'Krever SRR Tilgang',
description: 'Denne ressursen krever SRR rettigheter for tilgang.',
rightDescription: 'Denne ressursen krever SRR rettigheter for tilgang.',
delegable: true,
resourceOwnerName: 'Manglende SRR Rettigheter',
authorizationReference: [
{
id: 'urn:altinn:resource',
value: 'missing_srr_rightAccess',
},
],
},
{
identifier: 'delegation_error',
title: 'Delegering feilet',
description: 'Denne ressursen feiler ved delegering.',
rightDescription: 'Denne ressursen feiler ved delegering.',
delegable: true,
resourceOwnerName: 'Delegeringsfeil',
authorizationReference: [
{
id: 'urn:altinn:resource',
value: 'delegation_error',
},
],
},
{
identifier: 'partial_delegation_error',
title: 'Delegering delvis feilet',
description: 'Denne ressursen feiler delvis ved delegering.',
rightDescription: 'Denne ressursen feiler delvis ved delegering.',
delegable: true,
resourceOwnerName: 'Delegeringsfeil',
authorizationReference: [
{
id: 'urn:altinn:resource',
value: 'partial_delegation_error',
},
],
},
],
});
}),
http.get(ACCESSMANAGEMENT_BASE_URL + '/resources/resourceowners', () => {
return HttpResponse.json([
{
organisationName: 'NARNIA',
organisationNumber: '889640782',
},
]);
}),
];
Loading
Loading