mirror of
https://github.com/bitwarden/server
synced 2026-01-06 10:34:01 +00:00
SelectionReadOnly MERGE to CollectionGroup
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Table;
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Models.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
@@ -28,12 +30,12 @@ namespace Bit.Core.Models.Api
|
||||
|
||||
public class GroupDetailsResponseModel : GroupResponseModel
|
||||
{
|
||||
public GroupDetailsResponseModel(Group group, IEnumerable<Guid> collectionIds)
|
||||
public GroupDetailsResponseModel(Group group, IEnumerable<SelectionReadOnly> collections)
|
||||
: base(group, "groupDetails")
|
||||
{
|
||||
CollectionIds = collectionIds;
|
||||
Collections = collections.Select(c => new SelectionReadOnlyResponseModel(c));
|
||||
}
|
||||
|
||||
public IEnumerable<Guid> CollectionIds { get; set; }
|
||||
public IEnumerable<SelectionReadOnlyResponseModel> Collections { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,27 +52,10 @@ namespace Bit.Core.Models.Api
|
||||
IEnumerable<SelectionReadOnly> collections)
|
||||
: base(organizationUser, "organizationUserDetails")
|
||||
{
|
||||
Collections = collections.Select(c => new CollectionSelection(c));
|
||||
Collections = collections.Select(c => new SelectionReadOnlyResponseModel(c));
|
||||
}
|
||||
|
||||
public IEnumerable<CollectionSelection> Collections { get; set; }
|
||||
|
||||
public class CollectionSelection
|
||||
{
|
||||
public CollectionSelection(Data.SelectionReadOnly selection)
|
||||
{
|
||||
if(selection == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(selection));
|
||||
}
|
||||
|
||||
Id = selection.Id.ToString();
|
||||
ReadOnly = selection.ReadOnly;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
}
|
||||
public IEnumerable<SelectionReadOnlyResponseModel> Collections { get; set; }
|
||||
}
|
||||
public class OrganizationUserUserDetailsResponseModel : OrganizationUserResponseModel
|
||||
{
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Data;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class SelectionReadOnlyResponseModel
|
||||
{
|
||||
public SelectionReadOnlyResponseModel(SelectionReadOnly selection)
|
||||
{
|
||||
if(selection == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(selection));
|
||||
}
|
||||
|
||||
Id = selection.Id.ToString();
|
||||
ReadOnly = selection.ReadOnly;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public bool ReadOnly { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user