-
Notifications
You must be signed in to change notification settings - Fork 3
Connections API | GET connections/users & Connections API | GET /resource/instances/users #2613
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
.../Altinn.AccessManagement/src/Altinn.AccessMgmt.Core/Utils/Mappers/DtoMapper.Simplified.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| using Altinn.AccessMgmt.PersistenceEF.Models; | ||
| using Altinn.Authorization.Api.Contracts.AccessManagement; | ||
howieandersen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| namespace Altinn.AccessMgmt.Core.Utils; | ||
|
|
||
| /// <summary> | ||
| /// Mapper extension for simplified connections | ||
| /// </summary> | ||
| public partial class DtoMapper | ||
| { | ||
| /// <summary> | ||
| /// Converts a CompactEntityDto to SimplifiedPartyDto, excluding sensitive personal information | ||
| /// </summary> | ||
| /// <param name="entity">The entity to convert</param> | ||
| /// <returns>A simplified party DTO without PersonIdentifier/SSN, or null if entity is null</returns> | ||
| /// <remarks>This method explicitly excludes PersonIdentifier to comply with data privacy requirements</remarks> | ||
| public static SimplifiedPartyDto? ToSimplifiedParty(CompactEntityDto? entity) | ||
| { | ||
| if (entity is null) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| return new SimplifiedPartyDto | ||
| { | ||
| Id = entity.Id, | ||
| Name = entity.Name, | ||
| Type = entity.Type, | ||
| Variant = entity.Variant, | ||
| OrganizationIdentifier = entity.OrganizationIdentifier, | ||
| IsDeleted = entity.IsDeleted, | ||
| DeletedAt = entity.DeletedAt | ||
| }; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Converts a ConnectionDto to SimplifiedConnectionDto | ||
| /// </summary> | ||
| /// <param name="connection">The connection to convert</param> | ||
| /// <returns>A simplified connection DTO, or null if connection is null</returns> | ||
| public static SimplifiedConnectionDto? ToSimplifiedConnection(ConnectionDto? connection) | ||
| { | ||
| if (connection is null) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| return new SimplifiedConnectionDto | ||
| { | ||
| Party = ToSimplifiedParty(connection.Party), | ||
| Connections = connection.Connections?.Select(ToSimplifiedConnection).ToList() ?? [] | ||
| }; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Converts a collection of ConnectionDto to simplified connections | ||
| /// </summary> | ||
| /// <param name="connections">The connections to convert</param> | ||
| /// <returns>A collection of simplified connection DTOs</returns> | ||
| public static IEnumerable<SimplifiedConnectionDto> ToSimplifiedConnections(IEnumerable<ConnectionDto>? connections) | ||
| { | ||
| return connections?.Select(ToSimplifiedConnection) ?? Enumerable.Empty<SimplifiedConnectionDto>(); | ||
| } | ||
| } | ||
21 changes: 21 additions & 0 deletions
21
...tracts/src/Altinn.Authorization.Api.Contracts/AccessManagement/SimplifiedConnectionDto.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Altinn.Authorization.Api.Contracts.AccessManagement; | ||
|
|
||
| /// <summary> | ||
| /// Simplified connection for listing available users | ||
| /// </summary> | ||
| public class SimplifiedConnectionDto | ||
| { | ||
| /// <summary> | ||
| /// The party information | ||
| /// </summary> | ||
| [JsonPropertyName("party")] | ||
| public SimplifiedPartyDto Party { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Sub-connections (nested users under this party) | ||
| /// </summary> | ||
| [JsonPropertyName("connections")] | ||
| public List<SimplifiedConnectionDto> Connections { get; set; } = new(); | ||
| } |
51 changes: 51 additions & 0 deletions
51
...i.Contracts/src/Altinn.Authorization.Api.Contracts/AccessManagement/SimplifiedPartyDto.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Altinn.Authorization.Api.Contracts.AccessManagement; | ||
|
|
||
| /// <summary> | ||
| /// Simplified party information for connections API responses | ||
| /// </summary> | ||
| public class SimplifiedPartyDto | ||
| { | ||
| /// <summary> | ||
| /// The unique identifier for the party | ||
| /// </summary> | ||
| [JsonPropertyName("id")] | ||
| public Guid Id { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The name of the party | ||
| /// </summary> | ||
| [JsonPropertyName("name")] | ||
| public string Name { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The type of party (Person, Organization, etc.) | ||
| /// </summary> | ||
| [JsonPropertyName("type")] | ||
| public string Type { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The variant/subtype of the party | ||
| /// </summary> | ||
| [JsonPropertyName("variant")] | ||
| public string Variant { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Organization number (only for organizations) | ||
| /// </summary> | ||
| [JsonPropertyName("organizationIdentifier")] | ||
| public string? OrganizationIdentifier { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Indicates if the party is deleted | ||
| /// </summary> | ||
| [JsonPropertyName("isDeleted")] | ||
| public bool IsDeleted { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The timestamp when the party was deleted | ||
| /// </summary> | ||
| [JsonPropertyName("deletedAt")] | ||
| public DateTimeOffset? DeletedAt { get; set; } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.