Skip to content

Fix null role and wrong agent timestamp in the v1 client delegation responses #3789

Description

@howieandersen

Problem

Two endpoints under accessmanagement/api/v1/enduser/clientdelegations return wrong values:

  • GET my/clientproviders builds each access entry with DtoMapper.ConvertCompactRole(a.Role), but the query only includes a.From, so the role navigation is never loaded and every provider serializes "role": null.
  • GET clients/accesspackages sets agentAddedAt from the agent entity row (To.Audit_ValidFrom), so the field carries the time the agent entity was created instead of the time the agent assignment was made.

Both were found while mirroring the API for v2 in PR #3788. The v2 methods return the corrected values, and the v1 methods were left alone there since that PR keeps /v1/ byte identical.

Goal

v1 returns the same corrected values as v2: the role populated from RoleConstants.Agent.Entity (the query already filters on that role), and agentAddedAt taken from the agent assignment's Audit_ValidFrom.

Approach

Mirror the v2 fixes in the v1 methods in ClientDelegationService, and pin the corrected values with integration tests.

Work

  • GetMyProviders: map the role from RoleConstants.Agent.Entity
  • GetDelegatedAccessPackagesFromClientsViaParty: project AgentAddedAt from the delegation's agent assignment
  • Integration tests asserting the corrected role and timestamp

Out of scope

The other v1 gaps noted in the PR #3788 review (missing 204 in the v1 swagger doc, tracked reads in GetAgents) stay as they are.

Constraints / principles

Both fixes change observable v1 response values: role goes from null to the agent role, and agentAddedAt moves from entity creation time to assignment time. Consumers reading these fields today will see different values, so no PR until this is confirmed wanted.

@jonkjetiloye ok to correct these two in v1?

Related to #3770 and PR #3788.

Metadata

Metadata

Assignees

Labels

BackendThis is a backend task

Type

Fields

No fields configured for Task.

Projects

Status
✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions