Skip to content

Connections API | GET connections/users & Connections API | GET /resource/instances/users#2613

Merged
howieandersen merged 3 commits intomainfrom
2579_2581_GET_users_connections_instance
Mar 20, 2026
Merged

Connections API | GET connections/users & Connections API | GET /resource/instances/users#2613
howieandersen merged 3 commits intomainfrom
2579_2581_GET_users_connections_instance

Conversation

@howieandersen
Copy link
Contributor

…579, #2581)

Add two new GET endpoints to ConnectionsController:

  • GET /connections/users - retrieves available users with existing access from a party
  • GET /resources/instances/users - lists users with access to a specific instance

New DTOs:

  • SimplifiedPartyDto: party information excluding sensitive personal identifiers
  • SimplifiedConnectionDto: simplified connection structure without access details

New mapper utilities:

  • DtoMapper.Simplified: conversion methods for simplified DTOs with nullable reference types

Both endpoints require POLICY_INSTANCE_DELEGATION authorization and exclude PersonIdentifier/SSN from responses for data privacy compliance.

Description

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

, #2581)

Add two new GET endpoints to ConnectionsController:
- GET /connections/users - retrieves available users with existing access from a party
- GET /resources/instances/users - lists users with access to a specific instance

New DTOs:
- SimplifiedPartyDto: party information excluding sensitive personal identifiers
- SimplifiedConnectionDto: simplified connection structure without access details

New mapper utilities:
- DtoMapper.Simplified: conversion methods for simplified DTOs with nullable reference types

Both endpoints require POLICY_INSTANCE_DELEGATION authorization and exclude
PersonIdentifier/SSN from responses for data privacy compliance.
Copilot AI review requested due to automatic review settings March 20, 2026 07:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds privacy-preserving “simplified” DTOs and exposes two new enduser Connections API GET endpoints to list (1) available users already connected to a party and (2) users with access to a specific resource instance, both guarded by the instance delegation authorization policy.

Changes:

  • Added SimplifiedPartyDto and SimplifiedConnectionDto contracts to exclude sensitive identifiers (e.g., SSN/person identifier) from responses.
  • Added DtoMapper utilities to map existing connection/entity DTOs into the simplified response DTOs.
  • Added two new endpoints in ConnectionsController: GET .../connections/users and GET .../connections/resources/instances/users.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/libs/Altinn.Authorization.Api.Contracts/.../SimplifiedPartyDto.cs New simplified party DTO for response payloads without sensitive identifiers.
src/libs/Altinn.Authorization.Api.Contracts/.../SimplifiedConnectionDto.cs New simplified connection DTO for nested “available users” listing.
src/apps/Altinn.AccessManagement/.../DtoMapper.Simplified.cs New mapping helpers to produce simplified DTOs from existing connection/entity DTOs.
src/apps/Altinn.AccessManagement/.../ConnectionsController.cs Adds the two new GET endpoints for available users and instance users.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add ParameterValidation.Party() to GetAvailableUsers and GetInstanceUsers
  endpoints to reject Guid.Empty party parameter with 400 Bad Request
- Remove unused Altinn.AccessMgmt.PersistenceEF.Models using directive from
  DtoMapper.Simplified.cs
Add proper scope-based authorization policies to GetAvailableUsers and
GetInstanceUsers endpoints to align with existing controller patterns:

- GetAvailableUsers (GET /connections/users):
  * POLICY_ENDUSER_CONNECTIONS_WRITE_TOOTHERS - write preparation endpoint
  * POLICY_INSTANCE_DELEGATION - instance delegation specific

- GetInstanceUsers (GET /resources/instances/users):
  * POLICY_ENDUSER_CONNECTIONS_BIDRECTIONAL_READ - read operation
  * POLICY_INSTANCE_DELEGATION - instance delegation specific

This ensures proper authorization checks consistent with other endpoints like
CheckInstance, GetInstanceRights, and delegation check endpoints.
@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for 'Authorization Altinn.Authorization.Api.Contracts'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@howieandersen howieandersen merged commit 6048127 into main Mar 20, 2026
12 checks passed
@howieandersen howieandersen deleted the 2579_2581_GET_users_connections_instance branch March 20, 2026 14:59
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'Authorization Altinn.AccessManagement'

Failed conditions
0.0% Coverage on New Code (required ≥ 65%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants