1
0
mirror of https://github.com/bitwarden/server synced 2025-12-20 02:03:46 +00:00
Files
server/src/Core/Models/Api/Request/GroupRequestModel.cs
2017-07-27 14:08:39 -04:00

36 lines
930 B
C#

using System;
using System.ComponentModel.DataAnnotations;
using Bit.Core.Models.Table;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Bit.Core.Models.Api
{
public class GroupRequestModel
{
[Required]
[StringLength(50)]
public string Name { get; set; }
[Required]
public bool? AccessAll { get; set; }
public string ExternalId { get; set; }
public IEnumerable<SelectionReadOnlyRequestModel> Collections { get; set; }
public Group ToGroup(Guid orgId)
{
return ToGroup(new Group
{
OrganizationId = orgId
});
}
public Group ToGroup(Group existingGroup)
{
existingGroup.Name = Name;
existingGroup.AccessAll = AccessAll.Value;
existingGroup.ExternalId = ExternalId;
return existingGroup;
}
}
}