-
Notifications
You must be signed in to change notification settings - Fork 11
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
Endpoint for fetching current party roles #983
base: main
Are you sure you want to change the base?
Conversation
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.
LGTM
/// <param name="userId">The user id.</param> | ||
/// <param name="userPartyId">The user party id.</param> | ||
/// <returns>A list of roles for the user on the specified party.</returns> | ||
public async Task<List<Role>> GetUserRolesAsync(int userId, int userPartyId) |
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.
I wonder if we should return IEnumerable<>
or IReadOnlyList<>
instead, to express the intended usage
/// <returns>A list of roles for the user on the specified party.</returns> | ||
public async Task<List<Role>> GetUserRolesAsync(int userId, int userPartyId) | ||
{ | ||
List<Role> roles = new(); |
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.
Usually we wrap the body in activity (distributed trace spans). You can probably find example usages of Telemetry
"An error occurred while retrieving roles for userId {UserId} and partyId {PartyId}", | ||
userId, | ||
userPartyId | ||
); |
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.
I'm not sure about the error handling here. If the API fails for some reason we return an empty list, which might make it look like the user has no roles when in fact the problem was that we couldn't find out at all
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.
Good point.
Adds endpoint for fetching the users current party roles.
You need this PR in localtest to test:
Altinn/app-localtest#131
Description
/api/authorization/roles
to AuthorizationControllerRelated Issue(s)
Verification
Documentation