mirror of
https://github.com/bitwarden/server.git
synced 2025-02-02 23:41:21 +01:00
Move request/response models (#1754)
This commit is contained in:
parent
3ae573bd8d
commit
63f6dd9a24
@ -23,7 +23,6 @@ using System.Threading.Tasks;
|
||||
using Bit.Core.Models;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Utilities;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Settings;
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
using Bit.Core;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api.Request.Accounts;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Table;
|
||||
@ -17,6 +15,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Request.Accounts;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Core.Enums.Provider;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
|
@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Context;
|
||||
@ -15,6 +14,10 @@ using Bit.Core.Models.Table;
|
||||
using Bit.Core.Settings;
|
||||
using Core.Models.Data;
|
||||
using Azure.Messaging.EventGrid;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Request.Accounts;
|
||||
using Bit.Api.Models.Request.Organizations;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Core.Models.Data;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
@ -600,8 +603,8 @@ namespace Bit.Api.Controllers
|
||||
throw new BadRequestException($"Max file size is {CipherService.MAX_FILE_SIZE_READABLE}.");
|
||||
}
|
||||
|
||||
|
||||
var (attachmentId, uploadUrl) = await _cipherService.CreateAttachmentForDelayedUploadAsync(cipher, request, userId);
|
||||
var (attachmentId, uploadUrl) = await _cipherService.CreateAttachmentForDelayedUploadAsync(cipher,
|
||||
request.Key, request.FileName, request.FileSize, request.AdminRequest, userId);
|
||||
return new AttachmentUploadDataResponseModel
|
||||
{
|
||||
AttachmentId = attachmentId,
|
||||
@ -713,7 +716,8 @@ namespace Bit.Api.Controllers
|
||||
{
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), userId);
|
||||
return await _cipherService.GetAttachmentDownloadDataAsync(cipher, attachmentId);
|
||||
var result = await _cipherService.GetAttachmentDownloadDataAsync(cipher, attachmentId);
|
||||
return new AttachmentResponseModel(result.Id, result.Data, result.Cipher, _globalSettings);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/attachment/{attachmentId}/share")]
|
||||
|
@ -4,12 +4,13 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Models.Table;
|
||||
using System.Collections.Generic;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
|
@ -2,10 +2,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Services;
|
||||
|
@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Request.Organizations;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api.Request;
|
||||
using Bit.Core.Models.Api.Response;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@ -20,15 +21,18 @@ namespace Bit.Api.Controllers
|
||||
private readonly IUserService _userService;
|
||||
private readonly IEmergencyAccessRepository _emergencyAccessRepository;
|
||||
private readonly IEmergencyAccessService _emergencyAccessService;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
|
||||
public EmergencyAccessController(
|
||||
IUserService userService,
|
||||
IEmergencyAccessRepository emergencyAccessRepository,
|
||||
IEmergencyAccessService emergencyAccessService)
|
||||
IEmergencyAccessService emergencyAccessService,
|
||||
IGlobalSettings globalSettings)
|
||||
{
|
||||
_userService = userService;
|
||||
_emergencyAccessRepository = emergencyAccessRepository;
|
||||
_emergencyAccessService = emergencyAccessService;
|
||||
_globalSettings = globalSettings;
|
||||
}
|
||||
|
||||
[HttpGet("trusted")]
|
||||
@ -161,14 +165,17 @@ namespace Bit.Api.Controllers
|
||||
public async Task<EmergencyAccessViewResponseModel> ViewCiphers(string id)
|
||||
{
|
||||
var user = await _userService.GetUserByPrincipalAsync(User);
|
||||
return await _emergencyAccessService.ViewAsync(new Guid(id), user);
|
||||
var viewResult = await _emergencyAccessService.ViewAsync(new Guid(id), user);
|
||||
return new EmergencyAccessViewResponseModel(_globalSettings, viewResult.EmergencyAccess, viewResult.Ciphers);
|
||||
}
|
||||
|
||||
[HttpGet("{id}/{cipherId}/attachment/{attachmentId}")]
|
||||
public async Task<AttachmentResponseModel> GetAttachmentData(string id, string cipherId, string attachmentId)
|
||||
{
|
||||
var user = await _userService.GetUserByPrincipalAsync(User);
|
||||
return await _emergencyAccessService.GetAttachmentDownloadAsync(new Guid(id), cipherId, attachmentId, user);
|
||||
var result =
|
||||
await _emergencyAccessService.GetAttachmentDownloadAsync(new Guid(id), cipherId, attachmentId, user);
|
||||
return new AttachmentResponseModel(result.Id, result.Data, result.Cipher, _globalSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Response;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Models.Data;
|
||||
|
@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
|
||||
|
@ -4,11 +4,12 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Context;
|
||||
using System.Collections.Generic;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
|
@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Models.Api;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Utilities;
|
||||
|
@ -1,12 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Models.Api;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Settings;
|
||||
using Stripe;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
|
@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request.Organizations;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api.Request;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
|
@ -4,11 +4,12 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Context;
|
||||
using System.Collections.Generic;
|
||||
using Bit.Api.Models.Request.Organizations;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Models.Data;
|
||||
@ -136,7 +137,7 @@ namespace Bit.Api.Controllers
|
||||
|
||||
var userId = _userService.GetProperUserId(User);
|
||||
var result = await _organizationService.InviteUsersAsync(orgGuidId, userId.Value,
|
||||
new (OrganizationUserInvite, string)[] { (new OrganizationUserInvite(model), null) });
|
||||
new (OrganizationUserInvite, string)[] { (new OrganizationUserInvite(model.ToData()), null) });
|
||||
}
|
||||
|
||||
[HttpPost("reinvite")]
|
||||
|
@ -1,16 +1,18 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Request.Accounts;
|
||||
using Bit.Api.Models.Request.Organizations;
|
||||
using Bit.Api.Models.Response;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Api.Utilities;
|
||||
using Bit.Core.Models.Api.Response;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
@ -1,10 +1,10 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Models.Api;
|
||||
using System.Linq;
|
||||
using Bit.Core.Repositories;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Response;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
|
@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Context;
|
||||
|
@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request.Providers;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.Models.Response.Providers;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api.Request;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Utilities;
|
||||
|
@ -2,10 +2,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request.Providers;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.Models.Response.Providers;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Context;
|
||||
|
@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request.Providers;
|
||||
using Bit.Api.Models.Response.Providers;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
|
@ -1,14 +1,12 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Api;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Bit.Api.Utilities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Settings;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
@ -4,17 +4,17 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Models.Api.Response;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Context;
|
||||
using Azure.Messaging.EventGrid;
|
||||
using Bit.Api.Utilities;
|
||||
using System.Collections.Generic;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Core.Models.Table;
|
||||
using Newtonsoft.Json;
|
||||
using Bit.Core.Models.Data;
|
||||
|
@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Services;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Enums;
|
||||
@ -10,6 +9,7 @@ using Bit.Core.Exceptions;
|
||||
using System.Linq;
|
||||
using Bit.Core.Models.Table;
|
||||
using System.Collections.Generic;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Core.Enums.Provider;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Settings;
|
||||
|
@ -2,13 +2,16 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Services;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Enums;
|
||||
using System.Linq;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Request.Accounts;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.Models.Response.TwoFactor;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Utilities;
|
||||
|
@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Response;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class CipherAttachmentModel
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class CipherCardModel
|
||||
{
|
@ -1,9 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class CipherFieldModel
|
||||
{
|
||||
@ -23,5 +22,16 @@ namespace Bit.Core.Models.Api
|
||||
[EncryptedStringLength(5000)]
|
||||
public string Value { get; set; }
|
||||
public int? LinkedId { get; set; }
|
||||
|
||||
public CipherFieldData ToCipherFieldData()
|
||||
{
|
||||
return new CipherFieldData
|
||||
{
|
||||
Type = Type,
|
||||
Name = Name,
|
||||
Value = Value,
|
||||
LinkedId = LinkedId ?? null,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class CipherIdentityModel
|
||||
{
|
@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Enums;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class CipherLoginModel
|
||||
{
|
||||
@ -79,6 +78,11 @@ namespace Bit.Core.Models.Api
|
||||
[EncryptedStringLength(10000)]
|
||||
public string Uri { get; set; }
|
||||
public UriMatchType? Match { get; set; } = null;
|
||||
|
||||
public CipherLoginData.CipherLoginUriData ToCipherLoginUriData()
|
||||
{
|
||||
return new CipherLoginData.CipherLoginUriData { Uri = Uri, Match = Match, };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class CipherPasswordHistoryModel
|
||||
{
|
||||
@ -21,5 +21,10 @@ namespace Bit.Core.Models.Api
|
||||
public string Password { get; set; }
|
||||
[Required]
|
||||
public DateTime? LastUsedDate { get; set; }
|
||||
|
||||
public CipherPasswordHistoryData ToCipherPasswordHistoryData()
|
||||
{
|
||||
return new CipherPasswordHistoryData { Password = Password, LastUsedDate = LastUsedDate.Value, };
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class CipherSecureNoteModel
|
||||
{
|
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public
|
||||
{
|
||||
public abstract class AssociationWithPermissionsBaseModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public
|
||||
{
|
||||
public abstract class CollectionBaseModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public
|
||||
{
|
||||
public abstract class GroupBaseModel
|
||||
{
|
@ -4,7 +4,7 @@ using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public
|
||||
{
|
||||
public abstract class MemberBaseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public
|
||||
{
|
||||
public abstract class PolicyBaseModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Models.Data;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class AssociationWithPermissionsRequestModel : AssociationWithPermissionsBaseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class CollectionUpdateRequestModel : CollectionBaseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Bit.Core.Exceptions;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class EventFilterRequestModel
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class GroupCreateUpdateRequestModel : GroupBaseModel
|
||||
{
|
@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class MemberCreateRequestModel : MemberUpdateRequestModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class MemberUpdateRequestModel : MemberBaseModel
|
||||
{
|
@ -1,9 +1,10 @@
|
||||
using Bit.Core.Models.Business;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Business;
|
||||
using Table = Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class OrganizationImportRequestModel
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
using Bit.Core.Models.Table;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class PolicyUpdateRequestModel : PolicyBaseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class UpdateGroupIdsRequestModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
public class UpdateMemberIdsRequestModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Data;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
public class AssociationWithPermissionsResponseModel : AssociationWithPermissionsBaseModel
|
||||
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection.
|
@ -1,9 +1,9 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
public class ErrorResponseModel : IResponseModel
|
||||
{
|
@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// An event log.
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// A user group.
|
@ -1,4 +1,4 @@
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
public interface IResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
public class ListResponseModel<T> : IResponseModel where T : IResponseModel
|
||||
{
|
@ -6,7 +6,7 @@ using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// An organization member.
|
@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Table;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Core.Models.Api.Public
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// A policy.
|
||||
@ -43,6 +44,6 @@ namespace Bit.Core.Models.Api.Public
|
||||
/// The type of policy.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Enums.PolicyType? Type { get; set; }
|
||||
public PolicyType? Type { get; set; }
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class DeleteRecoverRequestModel
|
||||
{
|
@ -1,8 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class EmailRequestModel : SecretVerificationRequestModel
|
||||
{
|
@ -1,8 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class EmailTokenRequestModel : SecretVerificationRequestModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class ImportCiphersRequestModel
|
||||
{
|
@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class KdfRequestModel : PasswordRequestModel, IValidatableObject
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Models.Table;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class KeysRequestModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class PasswordHintRequestModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class PasswordRequestModel : SecretVerificationRequestModel
|
||||
{
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class PreloginRequestModel
|
||||
{
|
@ -1,16 +1,15 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Settings;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Enums = Bit.Core.Enums;
|
||||
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class PremiumRequestModel : IValidatableObject
|
||||
{
|
||||
[Required]
|
||||
public PaymentMethodType? PaymentMethodType { get; set; }
|
||||
public Enums.PaymentMethodType? PaymentMethodType { get; set; }
|
||||
public string PaymentToken { get; set; }
|
||||
[Range(0, 99)]
|
||||
public short? AdditionalStorageGb { get; set; }
|
@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class RegenerateTwoFactorRequestModel
|
||||
{
|
@ -2,12 +2,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class RegisterRequestModel : IValidatableObject, ICaptchaProtectedModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class SecretVerificationRequestModel : IValidatableObject
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Request.Accounts
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class SetKeyConnectorKeyRequestModel
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api.Request.Accounts
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class SetPasswordRequestModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class StorageRequestModel : IValidatableObject
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class TaxInfoUpdateRequestModel : IValidatableObject
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class UpdateKeyRequestModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class UpdateProfileRequestModel
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Api.Models.Request.Organizations;
|
||||
|
||||
namespace Bit.Core.Models.Api.Request.Accounts
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class UpdateTempPasswordRequestModel : OrganizationUserResetPasswordRequestModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class VerifyDeleteRecoverRequestModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class VerifyEmailRequestModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Accounts
|
||||
{
|
||||
public class VerifyOTPRequestModel
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class AttachmentRequestModel
|
||||
{
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Settings;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class BitPayInvoiceRequestModel : IValidatableObject
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class CipherPartialRequestModel
|
||||
{
|
@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Enums;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using Core.Models.Data;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
using Core.Models.Data;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class CipherRequestModel
|
||||
{
|
||||
@ -69,21 +69,21 @@ namespace Bit.Core.Models.Api
|
||||
switch (existingCipher.Type)
|
||||
{
|
||||
case CipherType.Login:
|
||||
var loginObj = JObject.FromObject(new CipherLoginData(this),
|
||||
var loginObj = JObject.FromObject(ToCipherLoginData(),
|
||||
new JsonSerializer { NullValueHandling = NullValueHandling.Ignore });
|
||||
loginObj[nameof(CipherLoginData.Uri)]?.Parent?.Remove();
|
||||
existingCipher.Data = loginObj.ToString(Formatting.None);
|
||||
break;
|
||||
case CipherType.Card:
|
||||
existingCipher.Data = JsonConvert.SerializeObject(new CipherCardData(this),
|
||||
existingCipher.Data = JsonConvert.SerializeObject(ToCipherCardData(),
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
break;
|
||||
case CipherType.Identity:
|
||||
existingCipher.Data = JsonConvert.SerializeObject(new CipherIdentityData(this),
|
||||
existingCipher.Data = JsonConvert.SerializeObject(ToCipherIdentityData(),
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
break;
|
||||
case CipherType.SecureNote:
|
||||
existingCipher.Data = JsonConvert.SerializeObject(new CipherSecureNoteData(this),
|
||||
existingCipher.Data = JsonConvert.SerializeObject(ToCipherSecureNoteData(),
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
break;
|
||||
default:
|
||||
@ -151,6 +151,87 @@ namespace Bit.Core.Models.Api
|
||||
Edit = true
|
||||
});
|
||||
}
|
||||
|
||||
private CipherLoginData ToCipherLoginData()
|
||||
{
|
||||
return new CipherLoginData
|
||||
{
|
||||
Name = Name,
|
||||
Notes = Notes,
|
||||
Fields = Fields?.Select(f => f.ToCipherFieldData()),
|
||||
PasswordHistory = PasswordHistory?.Select(ph => ph.ToCipherPasswordHistoryData()),
|
||||
|
||||
Uris =
|
||||
Login.Uris?.Where(u => u != null)
|
||||
.Select(u => u.ToCipherLoginUriData()),
|
||||
Username = Login.Username,
|
||||
Password = Login.Password,
|
||||
PasswordRevisionDate = Login.PasswordRevisionDate,
|
||||
Totp = Login.Totp,
|
||||
AutofillOnPageLoad = Login.AutofillOnPageLoad,
|
||||
};
|
||||
}
|
||||
|
||||
private CipherIdentityData ToCipherIdentityData()
|
||||
{
|
||||
return new CipherIdentityData
|
||||
{
|
||||
Name = Name,
|
||||
Notes = Notes,
|
||||
Fields = Fields?.Select(f => f.ToCipherFieldData()),
|
||||
PasswordHistory = PasswordHistory?.Select(ph => ph.ToCipherPasswordHistoryData()),
|
||||
|
||||
Title = Identity.Title,
|
||||
FirstName = Identity.FirstName,
|
||||
MiddleName = Identity.MiddleName,
|
||||
LastName = Identity.LastName,
|
||||
Address1 = Identity.Address1,
|
||||
Address2 = Identity.Address2,
|
||||
Address3 = Identity.Address3,
|
||||
City = Identity.City,
|
||||
State = Identity.State,
|
||||
PostalCode = Identity.PostalCode,
|
||||
Country = Identity.Country,
|
||||
Company = Identity.Company,
|
||||
Email = Identity.Email,
|
||||
Phone = Identity.Phone,
|
||||
SSN = Identity.SSN,
|
||||
Username = Identity.Username,
|
||||
PassportNumber = Identity.PassportNumber,
|
||||
LicenseNumber = Identity.LicenseNumber,
|
||||
};
|
||||
}
|
||||
|
||||
private CipherCardData ToCipherCardData()
|
||||
{
|
||||
return new CipherCardData
|
||||
{
|
||||
Name = Name,
|
||||
Notes = Notes,
|
||||
Fields = Fields?.Select(f => f.ToCipherFieldData()),
|
||||
PasswordHistory = PasswordHistory?.Select(ph => ph.ToCipherPasswordHistoryData()),
|
||||
|
||||
CardholderName = Card.CardholderName,
|
||||
Brand = Card.Brand,
|
||||
Number = Card.Number,
|
||||
ExpMonth = Card.ExpMonth,
|
||||
ExpYear = Card.ExpYear,
|
||||
Code = Card.Code,
|
||||
};
|
||||
}
|
||||
|
||||
private CipherSecureNoteData ToCipherSecureNoteData()
|
||||
{
|
||||
return new CipherSecureNoteData
|
||||
{
|
||||
Name = Name,
|
||||
Notes = Notes,
|
||||
Fields = Fields?.Select(f => f.ToCipherFieldData()),
|
||||
PasswordHistory = PasswordHistory?.Select(ph => ph.ToCipherPasswordHistoryData()),
|
||||
|
||||
Type = SecureNote.Type,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class CipherWithIdRequestModel : CipherRequestModel
|
@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Models.Table;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class CollectionRequestModel
|
||||
{
|
@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Enums;
|
||||
using Newtonsoft.Json;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class DeviceRequestModel
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api.Request
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class EmergencyAccessInviteRequestModel
|
||||
{
|
||||
@ -11,7 +12,7 @@ namespace Bit.Core.Models.Api.Request
|
||||
[StringLength(256)]
|
||||
public string Email { get; set; }
|
||||
[Required]
|
||||
public Enums.EmergencyAccessType? Type { get; set; }
|
||||
public EmergencyAccessType? Type { get; set; }
|
||||
[Required]
|
||||
public int WaitTimeDays { get; set; }
|
||||
}
|
||||
@ -19,7 +20,7 @@ namespace Bit.Core.Models.Api.Request
|
||||
public class EmergencyAccessUpdateRequestModel
|
||||
{
|
||||
[Required]
|
||||
public Enums.EmergencyAccessType Type { get; set; }
|
||||
public EmergencyAccessType Type { get; set; }
|
||||
[Required]
|
||||
public int WaitTimeDays { get; set; }
|
||||
public string KeyEncrypted { get; set; }
|
@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Models.Table;
|
||||
using Newtonsoft.Json;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class FolderRequestModel
|
||||
{
|
@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Table;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class GroupRequestModel
|
||||
{
|
@ -1,13 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Enums = Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class IapCheckRequestModel : IValidatableObject
|
||||
{
|
||||
[Required]
|
||||
public PaymentMethodType? PaymentMethodType { get; set; }
|
||||
public Enums.PaymentMethodType? PaymentMethodType { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
using Bit.Core.Models.Table;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class InstallationRequestModel
|
||||
{
|
||||
@ -14,7 +15,7 @@ namespace Bit.Core.Models.Api
|
||||
{
|
||||
return new Installation
|
||||
{
|
||||
Key = Utilities.CoreHelpers.SecureRandomString(20),
|
||||
Key = CoreHelpers.SecureRandomString(20),
|
||||
Email = Email,
|
||||
Enabled = true
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
public class LicenseRequestModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Organizations
|
||||
{
|
||||
public class ImportOrganizationCiphersRequestModel
|
||||
{
|
@ -1,10 +1,10 @@
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Models.Table;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Business;
|
||||
using Table = Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Organizations
|
||||
{
|
||||
public class ImportOrganizationUsersRequestModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Organizations
|
||||
{
|
||||
public class OrganizationCreateLicenseRequestModel : LicenseRequestModel
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
using Bit.Core.Models.Table;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Organizations
|
||||
{
|
||||
public class OrganizationCreateRequestModel : IValidatableObject
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using Bit.Core.Models.Table;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Organizations
|
||||
{
|
||||
public class OrganizationKeysRequestModel
|
||||
{
|
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Organizations
|
||||
{
|
||||
public class OrganizationSeatRequestModel : IValidatableObject
|
||||
{
|
@ -2,7 +2,7 @@ using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Organizations
|
||||
{
|
||||
public class OrganizationSponsorshipRedeemRequestModel
|
||||
{
|
@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Api.Request
|
||||
namespace Bit.Api.Models.Request.Organizations
|
||||
{
|
||||
public class OrganizationSponsorshipRequestModel
|
||||
{
|
@ -1,18 +1,18 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Sso;
|
||||
using U2F.Core.Utils;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text.RegularExpressions;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Sso;
|
||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
using U2F.Core.Utils;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
namespace Bit.Api.Models.Request.Organizations
|
||||
{
|
||||
public class OrganizationSsoRequestModel
|
||||
{
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user