mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 16:42:50 -05:00

* fix: remove AssignUserId from CollectionService.SaveAsync, refs AC-1669 * fix: add manage access conditional before creating collection, refs AC-1669 * fix: move access logic for create/update, fix all tests, refs AC-1669 * fix: add CollectionAccessSelection fixture, update tests, update bad reqeuest message, refs AC-1669 * fix: format, refs AC-1669 * fix: update null params with specific arg.is null checks, refs Ac-1669 * fix: update attribute class name, refs AC-1669
38 lines
916 B
C#
38 lines
916 B
C#
using System.Reflection;
|
|
using AutoFixture;
|
|
using AutoFixture.Xunit2;
|
|
using Bit.Core.Models.Data;
|
|
|
|
namespace Bit.Core.Test.AutoFixture;
|
|
|
|
public class CollectionAccessSelectionCustomization : ICustomization
|
|
{
|
|
public bool Manage { get; set; }
|
|
|
|
public CollectionAccessSelectionCustomization(bool manage)
|
|
{
|
|
Manage = manage;
|
|
}
|
|
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
fixture.Customize<CollectionAccessSelection>(composer => composer
|
|
.With(o => o.Manage, Manage));
|
|
}
|
|
}
|
|
|
|
public class CollectionAccessSelectionCustomizeAttribute : CustomizeAttribute
|
|
{
|
|
private readonly bool _manage;
|
|
|
|
public CollectionAccessSelectionCustomizeAttribute(bool manage = false)
|
|
{
|
|
_manage = manage;
|
|
}
|
|
|
|
public override ICustomization GetCustomization(ParameterInfo parameter)
|
|
{
|
|
return new CollectionAccessSelectionCustomization(_manage);
|
|
}
|
|
}
|