1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-11 01:01:36 +01:00

[PM-14378] Formatting

This commit is contained in:
Shane Melton 2024-12-11 16:44:57 -08:00
parent ca15550db1
commit bcf321064c
No known key found for this signature in database
5 changed files with 34 additions and 36 deletions

View File

@ -41,7 +41,8 @@ public class GetCipherPermissionsForUserQuery : IGetCipherPermissionsForUserQuer
cipher.Manage = true;
cipher.ViewPassword = true;
}
} else if (await CanAccessUnassignedCiphersAsync(org))
}
else if (await CanAccessUnassignedCiphersAsync(org))
{
foreach (var unassignedCipher in cipherPermissions.Where(c => c.Unassigned))
{

View File

@ -3,7 +3,6 @@ using Bit.Core.Context;
using Bit.Core.Enums;
using Bit.Core.Test.AdminConsole.AutoFixture;
using Bit.Core.Vault.Authorization.SecurityTasks;
using Bit.Core.Vault.Entities;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;
using Microsoft.AspNetCore.Authorization;

View File

@ -1,6 +1,4 @@
using AutoFixture;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Context;
using Bit.Core.Context;
using Bit.Core.Enums;
using Bit.Core.Models.Data.Organizations;
using Bit.Core.Services;
@ -24,7 +22,7 @@ public class GetCipherPermissionsForUserQueryTests
private static Guid _readExceptPasswordCipherId = Guid.NewGuid();
private static Guid _unassignedCipherId = Guid.NewGuid();
private static List<Guid> _cipherIds = new []
private static List<Guid> _cipherIds = new[]
{
_noAccessCipherId,
_readOnlyCipherId,
@ -53,16 +51,16 @@ public class GetCipherPermissionsForUserQueryTests
var result = await sutProvider.Sut.GetByOrganization(organizationId);
Assert.Equal(6, result.Count);
Assert.All(result, x => Assert.True(_cipherIds.Contains(x.Key)));
Assert.Equal(false, result[_noAccessCipherId].Read);
Assert.Equal(true, result[_readOnlyCipherId].Read);
Assert.Equal(false, result[_readOnlyCipherId].Edit);
Assert.Equal(true, result[_editCipherId].Edit);
Assert.Equal(true, result[_manageCipherId].Manage);
Assert.Equal(true, result[_readExceptPasswordCipherId].Read);
Assert.Equal(false, result[_readExceptPasswordCipherId].ViewPassword);
Assert.Equal(true, result[_unassignedCipherId].Unassigned);
Assert.Equal(false, result[_unassignedCipherId].Read);
Assert.All(result, x => Assert.Contains(x.Key, _cipherIds));
Assert.False(result[_noAccessCipherId].Read);
Assert.True(result[_readOnlyCipherId].Read);
Assert.False(result[_readOnlyCipherId].Edit);
Assert.True(result[_editCipherId].Edit);
Assert.True(result[_manageCipherId].Manage);
Assert.True(result[_readExceptPasswordCipherId].Read);
Assert.False(result[_readExceptPasswordCipherId].ViewPassword);
Assert.True(result[_unassignedCipherId].Unassigned);
Assert.False(result[_unassignedCipherId].Read);
}
[Theory, BitAutoData]
@ -83,7 +81,7 @@ public class GetCipherPermissionsForUserQueryTests
var result = await sutProvider.Sut.GetByOrganization(organizationId);
Assert.Equal(6, result.Count);
Assert.All(result, x => Assert.True(_cipherIds.Contains(x.Key)));
Assert.All(result, x => Assert.Contains(x.Key, _cipherIds));
Assert.All(result, x => Assert.True(x.Value.Read && x.Value.Edit && x.Value.Manage && x.Value.ViewPassword));
}
@ -110,7 +108,7 @@ public class GetCipherPermissionsForUserQueryTests
var result = await sutProvider.Sut.GetByOrganization(organizationId);
Assert.Equal(6, result.Count);
Assert.All(result, x => Assert.True(_cipherIds.Contains(x.Key)));
Assert.All(result, x => Assert.Contains(x.Key, _cipherIds));
Assert.All(result, x => Assert.True(x.Value.Read && x.Value.Edit && x.Value.Manage && x.Value.ViewPassword));
}
@ -132,20 +130,20 @@ public class GetCipherPermissionsForUserQueryTests
var result = await sutProvider.Sut.GetByOrganization(organizationId);
Assert.Equal(6, result.Count);
Assert.All(result, x => Assert.True(_cipherIds.Contains(x.Key)));
Assert.Equal(false, result[_noAccessCipherId].Read);
Assert.Equal(true, result[_readOnlyCipherId].Read);
Assert.Equal(false, result[_readOnlyCipherId].Edit);
Assert.Equal(true, result[_editCipherId].Edit);
Assert.Equal(true, result[_manageCipherId].Manage);
Assert.Equal(true, result[_readExceptPasswordCipherId].Read);
Assert.Equal(false, result[_readExceptPasswordCipherId].ViewPassword);
Assert.All(result, x => Assert.Contains(x.Key, _cipherIds));
Assert.False(result[_noAccessCipherId].Read);
Assert.True(result[_readOnlyCipherId].Read);
Assert.False(result[_readOnlyCipherId].Edit);
Assert.True(result[_editCipherId].Edit);
Assert.True(result[_manageCipherId].Manage);
Assert.True(result[_readExceptPasswordCipherId].Read);
Assert.False(result[_readExceptPasswordCipherId].ViewPassword);
Assert.Equal(true, result[_unassignedCipherId].Unassigned);
Assert.Equal(true, result[_unassignedCipherId].Read);
Assert.Equal(true, result[_unassignedCipherId].Edit);
Assert.Equal(true, result[_unassignedCipherId].ViewPassword);
Assert.Equal(true, result[_unassignedCipherId].Manage);
Assert.True(result[_unassignedCipherId].Unassigned);
Assert.True(result[_unassignedCipherId].Read);
Assert.True(result[_unassignedCipherId].Edit);
Assert.True(result[_unassignedCipherId].ViewPassword);
Assert.True(result[_unassignedCipherId].Manage);
}
private List<OrganizationCipherPermission> CreateCipherPermissions()