Files
server/src/Core/Models/Api/Response/GroupResponseModel.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2017-05-08 14:08:44 -04:00
using System;
using Bit.Core.Models.Table;
2017-05-08 22:14:01 -04:00
using System.Collections.Generic;
using Bit.Core.Models.Data;
using System.Linq;
2017-05-08 14:08:44 -04:00
namespace Bit.Core.Models.Api
{
public class GroupResponseModel : ResponseModel
{
public GroupResponseModel(Group group, string obj = "group")
: base(obj)
{
if (group == null)
2017-05-08 14:08:44 -04:00
{
throw new ArgumentNullException(nameof(group));
}
Id = group.Id.ToString();
OrganizationId = group.OrganizationId.ToString();
Name = group.Name;
AccessAll = group.AccessAll;
2017-05-12 14:02:33 -04:00
ExternalId = group.ExternalId;
2017-05-08 14:08:44 -04:00
}
public string Id { get; set; }
public string OrganizationId { get; set; }
public string Name { get; set; }
public bool AccessAll { get; set; }
2017-05-12 14:02:33 -04:00
public string ExternalId { get; set; }
2017-05-08 14:08:44 -04:00
}
2017-05-08 22:14:01 -04:00
public class GroupDetailsResponseModel : GroupResponseModel
{
public GroupDetailsResponseModel(Group group, IEnumerable<SelectionReadOnly> collections)
2017-05-08 22:14:01 -04:00
: base(group, "groupDetails")
{
Collections = collections.Select(c => new SelectionReadOnlyResponseModel(c));
2017-05-08 22:14:01 -04:00
}
public IEnumerable<SelectionReadOnlyResponseModel> Collections { get; set; }
2017-05-08 22:14:01 -04:00
}
2017-05-08 14:08:44 -04:00
}