-
Notifications
You must be signed in to change notification settings - Fork 3
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
Extend authorized parties with instance delegations #856
base: main
Are you sure you want to change the base?
Conversation
25f21d6
to
35577ab
Compare
src/Altinn.AccessManagement.Core/Repositories/Interfaces/IDelegationMetadataRepository.cs
Outdated
Show resolved
Hide resolved
src/Altinn.AccessManagement.Core/Services/AuthorizedPartiesService.cs
Outdated
Show resolved
Hide resolved
src/Altinn.AccessManagement.Persistence/DelegationMetadataRepo.cs
Outdated
Show resolved
Hide resolved
/// <summary> | ||
/// Composite Key instances | ||
/// </summary> | ||
public class Resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Burde ikke denne hete noe med Instance for ikke å blande den med AuthorizedResources som er av type string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mm, skal rename den
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blir kanskje ikke så synelig i File Changes PRen. Men klassen er definert inne i klassen AuthorizedParty. Så for å referere til klassen Resource utenfor klassen AuthorizedParty så må man bruke AuthorizedParty.Resource. Uansett, så endret jeg navnet til AuthorizedResource. Så det blir nå AuthorizedParty.AuthorizedResource.
@@ -164,10 +164,18 @@ public async Task<List<AuthorizedParty>> GetAuthorizedPartiesForEnterpriseUserUu | |||
return await Task.FromResult(new List<AuthorizedParty>()); | |||
} | |||
|
|||
private async Task<List<InstanceDelegationChange>> GetInstanceDelegations(int subjectUserId, List<int> subjectPartyIds, CancellationToken cancellationToken) | |||
{ | |||
var userId = subjectUserId != 0 ? subjectUserId.SingleToList() : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Det blir vel feil å legge inn en userid i en liste over partyids siden disse ikke brukes likt og ikke har samme verdi en user har en party id men den er ikke lik userid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jaja, var en god del issues med denne logikken. Har skrevet den om nå, ble ganske feil.
|
||
if (authorizedPartyDict.TryGetValue(instanceParty.PartyId, out var authorizedParty)) | ||
{ | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vil ikke denne continue blokken medføre at bare nye partyid får lagt til nye instanser om du har flere instanser så er det bare den første som blir lagt til og dersom du har en annen tilgang så blir ingen instanser lagt til siden den allerede ligger i dictionarien.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mm, har skrevet om logikken her.
WHERE | ||
touuid = ANY(@toUuid) | ||
GROUP BY | ||
resourceid, touuid, fromuuid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Samme som JK dersom du ikke har instanceId i group by så vil den slå sammen alle instansene desuten er det vel ikke mulig å bruke en group by og hente ut alle kolonner for de kolenne som ikke er grupert på vil kunne være mange verdier så de må ha en agregate funksjon for å finne hvilken som skal brukes. Jeg ville brukt Common table expression her og grupere på de dataene som var viktige og så hente ut max(instancedelegationchangeid) og deretter joine med denne common table expressionen med tabellen på nytt med id som match så ville jeg få ut alle siste endringer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stemmer, templating før jeg fikk testet spørringen. Endret på spørringen nu
test/Altinn.AccessManagement.Tests/Controllers/V2AuthorizedPartiesControllerTest.cs
Outdated
Show resolved
Hide resolved
Quality Gate failedFailed conditions |
Extend authorized parties with instance delegations.
Related Issue(s)
Developer/Reviewer Checklist
Documentation