Skip to content

Commit 379af92

Browse files
allinoxVedeler
and
Vedeler
authored
fixed cascading delete and only cache unused data for rightholders for 3 seconds (#1464)
Co-authored-by: Vedeler <acn-avede@ai-dev.no>
1 parent 1914f13 commit 379af92

File tree

3 files changed

+611
-1197
lines changed

3 files changed

+611
-1197
lines changed

backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI.Integration/Clients/RightHolderClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public async Task<HttpResponseMessage> PostNewRightHolder(Guid party, Guid to, C
6969
/// <inheritdoc/>
7070
public async Task<HttpResponseMessage> RevokeRightHolder(Guid party, Guid to)
7171
{
72-
string endpointUrl = $"enduser/connections?party={party}&from={party}&to={to}";
72+
string endpointUrl = $"enduser/connections?party={party}&from={party}&to={to}&cascade=true";
7373
string token = JwtTokenUtil.GetTokenFromContext(_httpContextAccessor.HttpContext, _platformSettings.JwtCookieName);
7474

7575
var httpResponse = await _client.DeleteAsync(token, endpointUrl);
@@ -97,7 +97,7 @@ public async Task<List<Connection>> GetRightHolders(Guid party, Guid? from, Guid
9797
{
9898
throw new HttpStatusException("Unexpected http response.", "Unexpected http response.", httpResponse.StatusCode, null, httpResponse.ReasonPhrase);
9999
}
100-
100+
101101
string content = await httpResponse.Content.ReadAsStringAsync();
102102
PaginatedResult<Connection> rightHolders = JsonSerializer.Deserialize<PaginatedResult<Connection>>(content, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
103103

src/rtk/features/userInfoApi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const userInfoApi = createApi({
6060
return headers;
6161
},
6262
}),
63+
tagTypes: ['UserInfo', 'RightHolders'],
6364
endpoints: (builder) => ({
6465
getUserInfo: builder.query<UserInfo, void>({
6566
query: () => 'profile',
@@ -91,7 +92,8 @@ export const userInfoApi = createApi({
9192
{
9293
query: ({ partyUuid, fromUuid, toUuid }) =>
9394
`rightholders?party=${partyUuid}&from=${fromUuid}&to=${toUuid}`,
94-
keepUnusedDataFor: 300,
95+
keepUnusedDataFor: 3,
96+
providesTags: ['RightHolders'],
9597
},
9698
),
9799
removeRightHolder: builder.mutation<void, { toPartyUuid: string; fromPartyUuid: string }>({

0 commit comments

Comments
 (0)