2017-05-08 14:08:44 -04:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using Bit.Core.Models.Table;
|
|
|
|
|
|
using Newtonsoft.Json;
|
2017-05-08 22:14:01 -04:00
|
|
|
|
using System.Collections.Generic;
|
2017-05-08 14:08:44 -04:00
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Models.Api
|
|
|
|
|
|
{
|
|
|
|
|
|
public class GroupRequestModel
|
|
|
|
|
|
{
|
|
|
|
|
|
[Required]
|
2018-10-22 09:34:26 -04:00
|
|
|
|
[StringLength(100)]
|
2017-05-08 14:08:44 -04:00
|
|
|
|
public string Name { get; set; }
|
2017-05-10 12:17:10 -04:00
|
|
|
|
[Required]
|
|
|
|
|
|
public bool? AccessAll { get; set; }
|
2018-10-22 09:40:44 -04:00
|
|
|
|
[StringLength(300)]
|
2017-05-12 14:02:33 -04:00
|
|
|
|
public string ExternalId { get; set; }
|
2017-05-11 11:41:13 -04:00
|
|
|
|
public IEnumerable<SelectionReadOnlyRequestModel> Collections { get; set; }
|
2017-05-08 14:08:44 -04:00
|
|
|
|
|
|
|
|
|
|
public Group ToGroup(Guid orgId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ToGroup(new Group
|
|
|
|
|
|
{
|
|
|
|
|
|
OrganizationId = orgId
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Group ToGroup(Group existingGroup)
|
|
|
|
|
|
{
|
|
|
|
|
|
existingGroup.Name = Name;
|
2017-05-10 12:17:10 -04:00
|
|
|
|
existingGroup.AccessAll = AccessAll.Value;
|
2017-05-12 14:02:33 -04:00
|
|
|
|
existingGroup.ExternalId = ExternalId;
|
2017-05-08 14:08:44 -04:00
|
|
|
|
return existingGroup;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|