Files
server/src/Core/Models/Api/Request/GroupRequestModel.cs

37 lines
959 B
C#
Raw Normal View History

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; }
[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; }
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;
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;
}
}
}