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 committed Dec 4, 2023
1 parent 9a05fa2 commit 05916be
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,16 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext
else if (context.Resource is InviteUserCommand inviteUserCommand && currentContact != null)
{
var currentUser = await userManager.FindByIdAsync(currentUserId);
result = currentContact.Organizations.Contains(inviteUserCommand.OrganizationId) && currentUser.StoreId.EqualsInvariant(inviteUserCommand.StoreId);

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

0 comments on commit 05916be

Please sign in to comment.