mirror of
https://github.com/bitwarden/server
synced 2026-01-07 19:13:50 +00:00
[PM-19145] refactor organization service.import async (#5800)
* initial lift and shift * extract function RemoveExistingExternalUsers * Extract function RemoveExistingUsers() * extract function OverwriteExisting() * create new model for sync data * extract add users to function, rename * rename OrganizatinUserInvite for command, implement command * implement command * refactor groups logic * fix imports * remove old tests, fix imports * fix namespace * fix CommandResult useage * tests wip * wip * wip * remove redundant code, remove looping db call, refactor tests * clean up * remove looping db call with bulk method * clean up * remove orgId param to use id already in request * change param * cleanup params * remove IReferenceEventService * fix test * fix tests * cr feedback * remove _timeProvider * add xmldoc, refactor to make InviteOrganizationUsersCommand vNext instead of default * switch back to command * re-add old ImportAsync impl * fix test * add feature flag * cleanup * clean up * fix tests * wip * wip * add api integration tests for users WIP * groups integration tests * cleanup * fix error from merging main * fix tests * cr feedback * fix test * fix test
This commit is contained in:
@@ -30,7 +30,6 @@ using NSubstitute;
|
||||
using NSubstitute.ExceptionExtensions;
|
||||
using Xunit;
|
||||
using static Bit.Core.Test.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Helpers.InviteUserOrganizationValidationRequestHelpers;
|
||||
using OrganizationUserInvite = Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Models.OrganizationUserInvite;
|
||||
|
||||
namespace Bit.Core.Test.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers;
|
||||
|
||||
@@ -54,7 +53,7 @@ public class InviteOrganizationUserCommandTests
|
||||
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites: [
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -112,7 +111,7 @@ public class InviteOrganizationUserCommandTests
|
||||
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites: [
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: orgUser.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -182,7 +181,7 @@ public class InviteOrganizationUserCommandTests
|
||||
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites: [
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -257,7 +256,7 @@ public class InviteOrganizationUserCommandTests
|
||||
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites: [
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -334,7 +333,7 @@ public class InviteOrganizationUserCommandTests
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites:
|
||||
[
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -411,7 +410,7 @@ public class InviteOrganizationUserCommandTests
|
||||
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites: [
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -492,7 +491,7 @@ public class InviteOrganizationUserCommandTests
|
||||
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites: [
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -566,7 +565,7 @@ public class InviteOrganizationUserCommandTests
|
||||
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites: [
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -669,7 +668,7 @@ public class InviteOrganizationUserCommandTests
|
||||
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites: [
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -768,7 +767,7 @@ public class InviteOrganizationUserCommandTests
|
||||
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites: [
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -863,7 +862,7 @@ public class InviteOrganizationUserCommandTests
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites:
|
||||
[
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
@@ -942,7 +941,7 @@ public class InviteOrganizationUserCommandTests
|
||||
var request = new InviteOrganizationUsersRequest(
|
||||
invites:
|
||||
[
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: user.Email,
|
||||
assignedCollections: [],
|
||||
groups: [],
|
||||
|
||||
@@ -14,7 +14,6 @@ using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using NSubstitute;
|
||||
using NSubstitute.ExceptionExtensions;
|
||||
using Xunit;
|
||||
using OrganizationUserInvite = Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Models.OrganizationUserInvite;
|
||||
|
||||
namespace Bit.Core.Test.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation;
|
||||
|
||||
@@ -36,13 +35,13 @@ public class InviteOrganizationUsersValidatorTests
|
||||
{
|
||||
Invites =
|
||||
[
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: "test@email.com",
|
||||
externalId: "test-external-id"),
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: "test2@email.com",
|
||||
externalId: "test-external-id2"),
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: "test3@email.com",
|
||||
externalId: "test-external-id3")
|
||||
],
|
||||
@@ -82,13 +81,13 @@ public class InviteOrganizationUsersValidatorTests
|
||||
{
|
||||
Invites =
|
||||
[
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: "test@email.com",
|
||||
externalId: "test-external-id"),
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: "test2@email.com",
|
||||
externalId: "test-external-id2"),
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: "test3@email.com",
|
||||
externalId: "test-external-id3")
|
||||
],
|
||||
@@ -126,13 +125,13 @@ public class InviteOrganizationUsersValidatorTests
|
||||
{
|
||||
Invites =
|
||||
[
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: "test@email.com",
|
||||
externalId: "test-external-id"),
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: "test2@email.com",
|
||||
externalId: "test-external-id2"),
|
||||
new OrganizationUserInvite(
|
||||
new OrganizationUserInviteCommandModel(
|
||||
email: "test3@email.com",
|
||||
externalId: "test-external-id3")
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user