Skip to content

Commit

Permalink
Return NotFound for userID 0 (#155)
Browse files Browse the repository at this point in the history
Co-authored-by: Henning Normann <h.normann@accenture.com>
  • Loading branch information
HenningNormann and Henning Normann authored May 22, 2024
1 parent 0d5a0b6 commit 368eb74
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Altinn.Profile/Controllers/UsersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public UsersController(IUserProfileService userProfileService)
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<UserProfile>> Get(int userID)

Check warning on line 46 in src/Altinn.Profile/Controllers/UsersController.cs

View workflow job for this annotation

GitHub Actions / Build, test & analyze

ModelState.IsValid should be checked in controller actions. (https://rules.sonarsource.com/csharp/RSPEC-6967)
{
if (userID == 0)
{
return NotFound();
}

Result<UserProfile, bool> result = await _userProfileService.GetUser(userID);

return result.Match<ActionResult<UserProfile>>(
Expand Down

0 comments on commit 368eb74

Please sign in to comment.