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

return share information with cipher API response

This commit is contained in:
Kyle Spearrin
2017-02-21 22:52:02 -05:00
parent 8051995cc7
commit 900e71d4dd
11 changed files with 123 additions and 15 deletions

View File

@ -1,15 +1,15 @@
using System;
using Bit.Core.Domains;
using Bit.Core.Models.Data;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Linq;
namespace Bit.Api.Models
{
public class CipherResponseModel : ResponseModel
{
public CipherResponseModel(Cipher cipher, Guid userId)
: base("cipher")
public CipherResponseModel(Cipher cipher, Guid userId, string obj = "cipher")
: base(obj)
{
if(cipher == null)
{
@ -40,7 +40,22 @@ namespace Bit.Api.Models
public Core.Enums.CipherType Type { get; set; }
public bool Favorite { get; set; }
public dynamic Data { get; set; }
public string Key { get; set; }
public DateTime RevisionDate { get; set; }
}
public class CipherShareResponseModel : CipherResponseModel
{
public CipherShareResponseModel(CipherShare cipherShare, Guid userId)
: base(cipherShare, userId, "cipherShare")
{
Key = cipherShare.Key;
Permissions = cipherShare.Permissions == null ? null :
JsonConvert.DeserializeObject<IEnumerable<Core.Enums.SharePermissionType>>(cipherShare.Permissions);
Status = cipherShare.Status;
}
public string Key { get; set; }
public IEnumerable<Core.Enums.SharePermissionType> Permissions { get; set; }
public Core.Enums.ShareStatusType? Status { get; set; }
}
}