Skip to content

Commit

Permalink
change order of permission checks for user mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
hahn-kev committed Jul 7, 2023
1 parent e24d1fa commit 818fb5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/LexBoxApi/GraphQL/UserMutations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public async Task<User> ChangeUserAccountData(
ChangeUserAccountDataInput input,
LexBoxDbContext dbContext)
{
if (loggedInContext.User.Id != input.UserId) throw new UnauthorizedAccessException();
var user = await dbContext.Users.FindAsync(input.UserId);
if (user is null) throw new NotFoundException("User not found");
if (loggedInContext.User.Id != input.UserId) throw new UnauthorizedAccessException();
// below works to change email
// minimum email = [email protected]
// if (input.Email is not null && input.Email != ""){
Expand Down

0 comments on commit 818fb5c

Please sign in to comment.