Skip to content

Commit

Permalink
PT-14646: disable anonymous inviteUser (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksavosteev authored Dec 4, 2023
1 parent 880283e commit 0378d6f
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,16 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext
}
else if (context.Resource is InviteUserCommand inviteUserCommand)
{
if (!string.IsNullOrEmpty(inviteUserCommand.OrganizationId) && currentContact != null)
var currentUser = await userManager.FindByIdAsync(currentUserId);

if (!string.IsNullOrEmpty(inviteUserCommand.OrganizationId) && currentContact != null && currentUser != null)
{
var currentUser = await userManager.FindByIdAsync(currentUserId);
result = currentContact.Organizations.Contains(inviteUserCommand.OrganizationId) && currentUser.StoreId.EqualsInvariant(inviteUserCommand.StoreId);
result = currentContact.Organizations.Contains(inviteUserCommand.OrganizationId)
&& currentUser.StoreId.EqualsInvariant(inviteUserCommand.StoreId);
}
else
else if (currentUser != null)
{
result = true;
result = currentUser.StoreId.EqualsInvariant(inviteUserCommand.StoreId);
}
}
else if (context.Resource is LockOrganizationContactCommand lockOrganizationContact)
Expand Down

0 comments on commit 0378d6f

Please sign in to comment.