Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public async Task<IActionResult> DeleteMyClientViaParty(
[HttpGet("clients")]
[Authorize(Policy = AuthzConstants.SCOPE_ENDUSER_CLIENTDELEGATION_READ)]
[Authorize(Policy = AuthzConstants.POLICY_CLIENTDELEGATION_READ)]
[ProducesResponseType<PaginatedResult<Altinn.Authorization.Api.Contracts.AccessManagement.ClientDto>>(StatusCodes.Status200OK, MediaTypeNames.Application.Json)]
[ProducesResponseType<PaginatedResult<ClientDto>>(StatusCodes.Status200OK, MediaTypeNames.Application.Json)]
[ProducesResponseType<AltinnProblemDetails>(StatusCodes.Status400BadRequest, MediaTypeNames.Application.Json)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
Expand All @@ -141,7 +141,7 @@ public async Task<IActionResult> GetClients(
[HttpGet("agents")]
[Authorize(Policy = AuthzConstants.SCOPE_ENDUSER_CLIENTDELEGATION_READ)]
[Authorize(Policy = AuthzConstants.POLICY_CLIENTDELEGATION_READ)]
[ProducesResponseType<PaginatedResult<Altinn.Authorization.Api.Contracts.AccessManagement.AgentDto>>(StatusCodes.Status200OK, MediaTypeNames.Application.Json)]
[ProducesResponseType<PaginatedResult<AgentDto>>(StatusCodes.Status200OK, MediaTypeNames.Application.Json)]
[ProducesResponseType<AltinnProblemDetails>(StatusCodes.Status400BadRequest, MediaTypeNames.Application.Json)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
Expand Down Expand Up @@ -224,7 +224,7 @@ public async Task<IActionResult> RemoveAgent(
[HttpGet("agents/accesspackages")]
[Authorize(Policy = AuthzConstants.SCOPE_ENDUSER_CLIENTDELEGATION_READ)]
[Authorize(Policy = AuthzConstants.POLICY_CLIENTDELEGATION_READ)]
[ProducesResponseType<PaginatedResult<Altinn.Authorization.Api.Contracts.AccessManagement.ClientDto>>(StatusCodes.Status200OK, MediaTypeNames.Application.Json)]
[ProducesResponseType<PaginatedResult<ClientDto>>(StatusCodes.Status200OK, MediaTypeNames.Application.Json)]
[ProducesResponseType<AltinnProblemDetails>(StatusCodes.Status400BadRequest, MediaTypeNames.Application.Json)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
Expand All @@ -245,7 +245,7 @@ public async Task<IActionResult> GetDelegatedAccessPackagesToAgentsViaPartyAsync
[HttpGet("clients/accesspackages")]
[Authorize(Policy = AuthzConstants.SCOPE_ENDUSER_CLIENTDELEGATION_READ)]
[Authorize(Policy = AuthzConstants.POLICY_CLIENTDELEGATION_READ)]
[ProducesResponseType<PaginatedResult<Altinn.Authorization.Api.Contracts.AccessManagement.AgentDto>>(StatusCodes.Status200OK, MediaTypeNames.Application.Json)]
[ProducesResponseType<PaginatedResult<AgentDto>>(StatusCodes.Status200OK, MediaTypeNames.Application.Json)]
[ProducesResponseType<AltinnProblemDetails>(StatusCodes.Status400BadRequest, MediaTypeNames.Application.Json)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
namespace Altinn.AccessManagement.Core.Models;
namespace Altinn.AccessManagement.Core.Models;

/// <summary>
/// Model representing a connected client party, meaning a party which has been authorized for one or more accesses, either directly or through role(s), access packages, resources or resource instances.
/// Model can be used both to represent a connection received from another party or a connection provided to another party.
/// </summary>
public class ClientDto
[Obsolete("new client DTO in contracts")]
public class _ClientDto
{
/// <summary>
/// Initializes a new instance of the <see cref="ClientDto"/> class.
/// Initializes a new instance of the <see cref="_ClientDto"/> class.
/// </summary>
public ClientDto()
public _ClientDto()
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ IDelegationRepository delegationRepository
private static readonly Guid PartyTypeOrganizationUuid = new Guid("8c216e2f-afdd-4234-9ba2-691c727bb33d");

/// <inheritdoc/>
public async Task<IEnumerable<ClientDto>> GetClients(Guid toId, string[] roles, string[] packages, CancellationToken cancellationToken = default)
public async Task<IEnumerable<_ClientDto>> GetClients(Guid toId, string[] roles, string[] packages, CancellationToken cancellationToken = default)
Copy link
Member

Choose a reason for hiding this comment

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

Men er det ikke noen som bruker disse operasjonene heller lenger heller? Ville i så fall forventet å se refaktorering også hvor disse blir brukt i så fall.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tenkte jeg skulle ta en annen refaktoring for å slette det, men irriterte meg at jeg måtte deklarer full path hver gang for klientdelegering..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

systembruker bruker vel fortsatt gamle kanskje?

{
// Fetch role metadata
var roleFilter = roleRepository.CreateFilterBuilder();
Expand Down Expand Up @@ -80,9 +80,9 @@ public async Task<IEnumerable<ClientDto>> GetClients(Guid toId, string[] roles,
return await GetFilteredClientsFromAssignments(clients, assignmentPackageResult, roleResult, packageResult, rolePackageResult, packages, cancellationToken);
}

private async Task<List<ClientDto>> GetFilteredClientsFromAssignments(IEnumerable<ExtAssignment> assignments, IEnumerable<AssignmentPackage> assignmentPackages, QueryResponse<Role> roles, QueryResponse<Package> packages, QueryResponse<RolePackage> rolePackages, string[] filterPackages, CancellationToken ct)
private async Task<List<_ClientDto>> GetFilteredClientsFromAssignments(IEnumerable<ExtAssignment> assignments, IEnumerable<AssignmentPackage> assignmentPackages, QueryResponse<Role> roles, QueryResponse<Package> packages, QueryResponse<RolePackage> rolePackages, string[] filterPackages, CancellationToken ct)
{
Dictionary<Guid, ClientDto> clients = new();
Dictionary<Guid, _ClientDto> clients = new();

// Fetch Entity metadata
var entityVariants = await entityVariantRepository.Get(cancellationToken: ct);
Expand All @@ -102,11 +102,11 @@ private async Task<List<ClientDto>> GetFilteredClientsFromAssignments(IEnumerabl
}

// Add client to dictionary if not already present
if (!clients.TryGetValue(assignment.FromId, out ClientDto client))
if (!clients.TryGetValue(assignment.FromId, out _ClientDto client))
{
client = new ClientDto()
client = new _ClientDto()
{
Party = new ClientDto.ClientParty
Party = new _ClientDto.ClientParty
{
Id = assignment.FromId,
Name = assignment.From.Name,
Expand All @@ -121,7 +121,7 @@ private async Task<List<ClientDto>> GetFilteredClientsFromAssignments(IEnumerabl
// Add packages client has been assigned
if (assignmentPackageNames.Length > 0)
{
client.Access.Add(new ClientDto.ClientRoleAccessPackages
client.Access.Add(new _ClientDto.ClientRoleAccessPackages
{
Role = roleName,
Packages = assignmentPackageNames
Expand All @@ -131,7 +131,7 @@ private async Task<List<ClientDto>> GetFilteredClientsFromAssignments(IEnumerabl
// Add packages client has through role
if (rolePackageNames.Length > 0)
{
client.Access.Add(new ClientDto.ClientRoleAccessPackages
client.Access.Add(new _ClientDto.ClientRoleAccessPackages
{
Role = roleName,
Packages = rolePackageNames
Expand All @@ -140,7 +140,7 @@ private async Task<List<ClientDto>> GetFilteredClientsFromAssignments(IEnumerabl
}

// Return only clients having all required filterpackages
List<ClientDto> result = new();
List<_ClientDto> result = new();
foreach (var client in clients.Keys)
{
var allClientPackages = clients[client].Access.SelectMany(rp => rp.Packages).Distinct();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public interface IAssignmentService
/// Fetches Client assignments.
/// </summary>
/// <returns></returns>
Task<IEnumerable<ClientDto>> GetClients(Guid toId, string[] roles, string[] packages, CancellationToken cancellationToken = default);
Task<IEnumerable<_ClientDto>> GetClients(Guid toId, string[] roles, string[] packages, CancellationToken cancellationToken = default);

/// <summary>
/// Fetches all assignment packages or role packages for a given assignments.
Expand Down
Loading