Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
TODO comment regarding authentication via policy rather than hardcoding it.
  • Loading branch information
YouriRombouts committed May 7, 2023
1 parent 63af4a4 commit 6678f7a
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public async Task<ActionResult<IEnumerable<UserGetDto>>> Get(Guid id)
var userId = User.Claims.FirstOrDefault(c => c.Type == "UserId")?.Value;
var userRole = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Role)?.Value;

// TODO: Use a policy to do this together with an IAuthorizationService
if (id.ToString() != userId && userRole != "Administrator")
{
return Unauthorized("You are not authorized to access this account's information.");
Expand Down

0 comments on commit 6678f7a

Please sign in to comment.