1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

support access all for collection user details

This commit is contained in:
Kyle Spearrin
2017-05-08 11:27:21 -04:00
parent 2c604d61b2
commit 9936f69481
9 changed files with 56 additions and 25 deletions

View File

@ -1,12 +1,26 @@
using System;
using Bit.Core.Models.Table;
using Bit.Core.Models.Data;
namespace Bit.Core.Models.Api
{
public class CollectionResponseModel : ResponseModel
{
public CollectionResponseModel(Collection collection)
: base("collection")
public CollectionResponseModel(Collection collection, string obj = "collection")
: base(obj)
{
if(collection == null)
{
throw new ArgumentNullException(nameof(collection));
}
Id = collection.Id.ToString();
OrganizationId = collection.OrganizationId.ToString();
Name = collection.Name;
}
public CollectionResponseModel(CollectionUserCollectionDetails collection, string obj = "collection")
: base(obj)
{
if(collection == null)
{
@ -22,4 +36,15 @@ namespace Bit.Core.Models.Api
public string OrganizationId { get; set; }
public string Name { get; set; }
}
public class CollectionUserDetailsResponseModel : CollectionResponseModel
{
public CollectionUserDetailsResponseModel(CollectionUserCollectionDetails collection)
: base(collection, "collectionUserDetails")
{
ReadOnly = collection.ReadOnly;
}
public bool ReadOnly { get; set; }
}
}

View File

@ -16,13 +16,11 @@ namespace Bit.Core.Models.Api
Id = details.Id.ToString();
Name = details.Name;
CollectionId = details.CollectionId.ToString();
ReadOnly = details.ReadOnly;
}
public string Id { get; set; }
public string Name { get; set; }
public string CollectionId { get; set; }
public bool ReadOnly { get; set; }
}
}

View File

@ -5,9 +5,8 @@ namespace Bit.Core.Models.Data
public class CollectionUserCollectionDetails
{
public Guid Id { get; set; }
public Guid OrganizationUserId { get; set; }
public Guid OrganizationId { get; set; }
public string Name { get; set; }
public Guid CollectionId { get; set; }
public bool ReadOnly { get; set; }
}
}