mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 16:42:50 -05:00
renaming collection linq predicates
This commit is contained in:
@ -12,11 +12,11 @@ namespace Bit.Core.Models.Api
|
||||
|
||||
public IEnumerable<CollectionUser> ToCollectionUsers()
|
||||
{
|
||||
return Collections.Select(s => new CollectionUser
|
||||
return Collections.Select(c => new CollectionUser
|
||||
{
|
||||
OrganizationUserId = new Guid(UserId),
|
||||
CollectionId = new Guid(s.CollectionId),
|
||||
ReadOnly = s.ReadOnly
|
||||
CollectionId = new Guid(c.CollectionId),
|
||||
ReadOnly = c.ReadOnly
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ namespace Bit.Core.Models.Api
|
||||
{
|
||||
if(collectionCiphers.ContainsKey(cipher.Id))
|
||||
{
|
||||
CollectionIds = collectionCiphers[cipher.Id].Select(s => s.CollectionId);
|
||||
CollectionIds = collectionCiphers[cipher.Id].Select(c => c.CollectionId);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -91,7 +91,7 @@ namespace Bit.Core.Models.Api
|
||||
string obj = "cipherDetails")
|
||||
: base(cipher, obj)
|
||||
{
|
||||
CollectionIds = collectionCiphers.Select(s => s.CollectionId);
|
||||
CollectionIds = collectionCiphers.Select(c => c.CollectionId);
|
||||
}
|
||||
|
||||
public IEnumerable<Guid> CollectionIds { get; set; }
|
||||
@ -105,7 +105,7 @@ namespace Bit.Core.Models.Api
|
||||
{
|
||||
if(collectionCiphers.ContainsKey(cipher.Id))
|
||||
{
|
||||
CollectionIds = collectionCiphers[cipher.Id].Select(s => s.CollectionId);
|
||||
CollectionIds = collectionCiphers[cipher.Id].Select(c => c.CollectionId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace Bit.Core.Models.Api
|
||||
: base(organizationUser, "organizationUserDetails")
|
||||
{
|
||||
Collections = new ListResponseModel<OrganizationUserCollectionResponseModel>(
|
||||
collections.Select(s => new OrganizationUserCollectionResponseModel(s)));
|
||||
collections.Select(c => new OrganizationUserCollectionResponseModel(c)));
|
||||
}
|
||||
|
||||
public ListResponseModel<OrganizationUserCollectionResponseModel> Collections { get; set; }
|
||||
|
@ -900,10 +900,10 @@ namespace Bit.Core.Services
|
||||
var currentUserCollections = newUser ? null : await _collectionUserRepository.GetManyByOrganizationUserIdAsync(user.Id);
|
||||
|
||||
// Let's make sure all these belong to this user and organization.
|
||||
var filteredCollections = collections.Where(s => orgCollections.Any(os => os.Id == s.CollectionId));
|
||||
var filteredCollections = collections.Where(c => orgCollections.Any(os => os.Id == c.CollectionId));
|
||||
foreach(var collection in filteredCollections)
|
||||
{
|
||||
var existingCollectionUser = currentUserCollections?.FirstOrDefault(cs => cs.CollectionId == collection.CollectionId);
|
||||
var existingCollectionUser = currentUserCollections?.FirstOrDefault(cu => cu.CollectionId == collection.CollectionId);
|
||||
if(existingCollectionUser != null)
|
||||
{
|
||||
collection.Id = existingCollectionUser.Id;
|
||||
@ -916,8 +916,8 @@ namespace Bit.Core.Services
|
||||
|
||||
if(!newUser)
|
||||
{
|
||||
var collectionsToDelete = currentUserCollections.Where(cs =>
|
||||
!filteredCollections.Any(s => s.CollectionId == cs.CollectionId));
|
||||
var collectionsToDelete = currentUserCollections.Where(cu =>
|
||||
!filteredCollections.Any(c => c.CollectionId == cu.CollectionId));
|
||||
foreach(var collection in collectionsToDelete)
|
||||
{
|
||||
await _collectionUserRepository.DeleteAsync(collection);
|
||||
|
Reference in New Issue
Block a user