mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00

* [AC-1174] Update SelectionReadOnlyRequestModel to use Guid for Id property * [AC-1174] Introduce initial bulk-access collection endpoint * [AC-1174] Introduce BulkAddCollectionAccessCommand and validation logic/tests * [AC-1174] Add CreateOrUpdateAccessMany method to CollectionRepository * [AC-1174] Add event logs for bulk add collection access command * [AC-1174] Add User_BumpAccountRevisionDateByCollectionIds and database migration script * [AC-1174] Implement EF repository method * [AC-1174] Improve null checks * [AC-1174] Remove unnecessary BulkCollectionAccessRequestModel helpers * [AC-1174] Add unit tests for new controller endpoint * [AC-1174] Fix formatting * [AC-1174] Remove comment * [AC-1174] Remove redundant organizationId parameter * [AC-1174] Ensure user and group Ids are distinct * [AC-1174] Cleanup tests based on PR feedback * [AC-1174] Formatting * [AC-1174] Update CollectionGroup alias in the sproc * [AC-1174] Add some additional comments to SQL sproc * [AC-1174] Add comment explaining additional SaveChangesAsync call --------- Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
56 lines
1.9 KiB
C#
56 lines
1.9 KiB
C#
using AutoFixture;
|
|
using Bit.Core.Context;
|
|
using Bit.Core.Entities;
|
|
using Bit.Core.Models.Data;
|
|
using Bit.Core.Test.AutoFixture;
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
|
|
|
namespace Bit.Core.Test.Vault.AutoFixture;
|
|
|
|
public class CollectionCustomization : ICustomization
|
|
{
|
|
private const int _collectionIdSeed = 1;
|
|
private const int _userIdSeed = 2;
|
|
private const int _groupIdSeed = 3;
|
|
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
var orgId = Guid.NewGuid();
|
|
|
|
fixture.Customize<Organization>(composer => composer
|
|
.With(o => o.Id, orgId));
|
|
|
|
fixture.Customize<CurrentContextOrganization>(composer => composer
|
|
.With(o => o.Id, orgId));
|
|
|
|
fixture.Customize<OrganizationUser>(composer => composer
|
|
.With(o => o.OrganizationId, orgId)
|
|
.WithGuidFromSeed(o => o.Id, _userIdSeed));
|
|
|
|
fixture.Customize<Collection>(composer => composer
|
|
.With(o => o.OrganizationId, orgId)
|
|
.WithGuidFromSeed(c => c.Id, _collectionIdSeed));
|
|
|
|
fixture.Customize<CollectionDetails>(composer => composer
|
|
.With(o => o.OrganizationId, orgId)
|
|
.WithGuidFromSeed(cd => cd.Id, _collectionIdSeed));
|
|
|
|
fixture.Customize<CollectionUser>(c => c
|
|
.WithGuidFromSeed(cu => cu.OrganizationUserId, _userIdSeed)
|
|
.WithGuidFromSeed(cu => cu.CollectionId, _collectionIdSeed));
|
|
|
|
fixture.Customize<Group>(composer => composer
|
|
.With(o => o.OrganizationId, orgId)
|
|
.WithGuidFromSeed(o => o.Id, _groupIdSeed));
|
|
|
|
fixture.Customize<CollectionGroup>(c => c
|
|
.WithGuidFromSeed(cu => cu.GroupId, _groupIdSeed)
|
|
.WithGuidFromSeed(cu => cu.CollectionId, _collectionIdSeed));
|
|
}
|
|
}
|
|
|
|
public class CollectionCustomizationAttribute : BitCustomizeAttribute
|
|
{
|
|
public override ICustomization GetCustomization() => new CollectionCustomization();
|
|
}
|