1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 17:12:49 -05:00

SelectionReadOnly MERGE to CollectionGroup

This commit is contained in:
Kyle Spearrin
2017-05-11 11:41:13 -04:00
parent f0d7dc8023
commit 2b8db4d1ed
18 changed files with 129 additions and 73 deletions

View File

@ -13,7 +13,7 @@ namespace Bit.Core.Models.Api
public string Name { get; set; }
[Required]
public bool? AccessAll { get; set; }
public IEnumerable<string> CollectionIds { get; set; }
public IEnumerable<SelectionReadOnlyRequestModel> Collections { get; set; }
public Group ToGroup(Guid orgId)
{

View File

@ -1,5 +1,4 @@
using Bit.Core.Models.Table;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@ -13,7 +12,7 @@ namespace Bit.Core.Models.Api
[Required]
public Enums.OrganizationUserType? Type { get; set; }
public bool AccessAll { get; set; }
public IEnumerable<OrganizationUserCollectionRequestModel> Collections { get; set; }
public IEnumerable<SelectionReadOnlyRequestModel> Collections { get; set; }
}
public class OrganizationUserAcceptRequestModel
@ -33,7 +32,7 @@ namespace Bit.Core.Models.Api
[Required]
public Enums.OrganizationUserType? Type { get; set; }
public bool AccessAll { get; set; }
public IEnumerable<OrganizationUserCollectionRequestModel> Collections { get; set; }
public IEnumerable<SelectionReadOnlyRequestModel> Collections { get; set; }
public OrganizationUser ToOrganizationUser(OrganizationUser existingUser)
{
@ -48,22 +47,4 @@ namespace Bit.Core.Models.Api
[Required]
public IEnumerable<string> GroupIds { get; set; }
}
public class OrganizationUserCollectionRequestModel
{
[Required]
public string CollectionId { get; set; }
public bool ReadOnly { get; set; }
public CollectionUser ToCollectionUser()
{
var collection = new CollectionUser
{
ReadOnly = ReadOnly,
CollectionId = new Guid(CollectionId)
};
return collection;
}
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
using Bit.Core.Models.Table;
using Bit.Core.Models.Data;
namespace Bit.Core.Models.Api
{
public class SelectionReadOnlyRequestModel
{
[Required]
public string Id { get; set; }
public bool ReadOnly { get; set; }
public CollectionUser ToCollectionUser()
{
return new CollectionUser
{
ReadOnly = ReadOnly,
CollectionId = new Guid(Id)
};
}
public SelectionReadOnly ToSelectionReadOnly()
{
return new SelectionReadOnly
{
Id = new Guid(Id),
ReadOnly = ReadOnly
};
}
}
}