mirror of
https://github.com/bitwarden/server
synced 2025-12-23 19:53:40 +00:00
[PM-29840] Correcting Auto-Confirm Org Accept User Flow (#6740)
* Populating org user userId and adding to allOrgUser list. * Having validator check organization user existence based off email or userid.
This commit is contained in:
@@ -270,7 +270,9 @@ public class AcceptOrgUserCommand : IAcceptOrgUserCommand
|
|||||||
ICollection<OrganizationUser> allOrgUsers, User user)
|
ICollection<OrganizationUser> allOrgUsers, User user)
|
||||||
{
|
{
|
||||||
var error = (await _automaticUserConfirmationPolicyEnforcementValidator.IsCompliantAsync(
|
var error = (await _automaticUserConfirmationPolicyEnforcementValidator.IsCompliantAsync(
|
||||||
new AutomaticUserConfirmationPolicyEnforcementRequest(orgUser.OrganizationId, allOrgUsers, user)))
|
new AutomaticUserConfirmationPolicyEnforcementRequest(orgUser.OrganizationId,
|
||||||
|
allOrgUsers.Append(orgUser),
|
||||||
|
user)))
|
||||||
.Match(
|
.Match(
|
||||||
error => error.Message,
|
error => error.Message,
|
||||||
_ => string.Empty
|
_ => string.Empty
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ public class AutomaticUserConfirmationPolicyEnforcementValidator(
|
|||||||
|
|
||||||
var currentOrganizationUser = request.AllOrganizationUsers
|
var currentOrganizationUser = request.AllOrganizationUsers
|
||||||
.FirstOrDefault(x => x.OrganizationId == request.OrganizationId
|
.FirstOrDefault(x => x.OrganizationId == request.OrganizationId
|
||||||
&& x.UserId == request.User.Id);
|
// invited users do not have a userId but will have email
|
||||||
|
&& (x.UserId == request.User.Id || x.Email == request.User.Email));
|
||||||
|
|
||||||
if (currentOrganizationUser is null)
|
if (currentOrganizationUser is null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user