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

remove old share solution code

This commit is contained in:
Kyle Spearrin
2017-02-28 22:51:29 -05:00
parent 321183c570
commit acb1fc0be5
17 changed files with 19 additions and 365 deletions

View File

@ -1,33 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Bit.Core.Domains;
using Newtonsoft.Json;
namespace Bit.Api.Models
{
public class ShareRequestModel
{
[Required]
public string Email { get; set; }
[Required]
[StringLength(36)]
public string CipherId { get; set; }
public string Key { get; set; }
public Share ToShare(Guid sharerUserId)
{
return ToShare(new Share
{
SharerUserId = sharerUserId
});
}
public Share ToShare(Share existingShare)
{
existingShare.CipherId = new Guid(CipherId);
existingShare.Key = Key;
return existingShare;
}
}
}

View File

@ -1,6 +1,5 @@
using System;
using Bit.Core.Domains;
using Bit.Core.Models.Data;
namespace Bit.Api.Models
{
@ -19,7 +18,6 @@ namespace Bit.Api.Models
Type = cipher.Type;
Favorite = cipher.Favorite;
RevisionDate = cipher.RevisionDate;
Key = cipher.Key;
switch(cipher.Type)
{
@ -38,21 +36,7 @@ namespace Bit.Api.Models
public string FolderId { get; set; }
public Core.Enums.CipherType Type { get; set; }
public bool Favorite { get; set; }
public string Key { get; set; }
public dynamic Data { get; set; }
public DateTime RevisionDate { get; set; }
}
public class CipherShareResponseModel : CipherResponseModel
{
public CipherShareResponseModel(CipherShare cipherShare, Guid userId)
: base(cipherShare, userId, "cipherShare")
{
ReadOnly = cipherShare.ReadOnly;
Status = cipherShare.Status;
}
public bool ReadOnly { get; set; }
public Core.Enums.ShareStatusType? Status { get; set; }
}
}

View File

@ -1,13 +1,12 @@
using System;
using Bit.Core.Domains;
using Bit.Core.Models.Data;
namespace Bit.Api.Models
{
public class LoginResponseModel : ResponseModel
{
public LoginResponseModel(Cipher cipher, Guid userId, string obj = "login")
: base("login")
: base(obj)
{
if(cipher == null)
{
@ -30,7 +29,6 @@ namespace Bit.Api.Models
Password = data.Password;
Notes = data.Notes;
RevisionDate = cipher.RevisionDate;
Key = cipher.Key;
}
public string Id { get; set; }
@ -42,22 +40,8 @@ namespace Bit.Api.Models
public string Password { get; set; }
public string Notes { get; set; }
public DateTime RevisionDate { get; set; }
public string Key { get; set; }
// Expandables
public FolderResponseModel Folder { get; set; }
}
public class LoginShareResponseModel : LoginResponseModel
{
public LoginShareResponseModel(CipherShare cipherShare, Guid userId)
: base(cipherShare, userId, "loginShare")
{
ReadOnly = cipherShare.ReadOnly;
Status = cipherShare.Status;
}
public bool ReadOnly { get; set; }
public Core.Enums.ShareStatusType? Status { get; set; }
}
}

View File

@ -1,33 +0,0 @@
using System;
using Bit.Core.Domains;
namespace Bit.Api.Models
{
public class ShareResponseModel : ResponseModel
{
public ShareResponseModel(Share share)
: base("share")
{
if(share == null)
{
throw new ArgumentNullException(nameof(share));
}
Id = share.Id.ToString();
UserId = share.UserId.ToString();
SharerUserId = share.SharerUserId.ToString();
CipherId = share.CipherId.ToString();
Key = Key;
ReadOnly = share.ReadOnly;
Status = share.Status;
}
public string Id { get; set; }
public string UserId { get; set; }
public string SharerUserId { get; set; }
public string CipherId { get; set; }
public string Key { get; set; }
public bool ReadOnly { get; set; }
public Core.Enums.ShareStatusType? Status { get; set; }
}
}