mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
CipherDetails Edit property
This commit is contained in:
@ -52,18 +52,19 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("{id}/full-details")]
|
||||
public async Task<CipherFullDetailsResponseModel> GetDetails(string id)
|
||||
[HttpGet("{id}/details")]
|
||||
public async Task<CipherDetailsResponseModel> GetDetails(string id)
|
||||
{
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var cipherId = new Guid(id);
|
||||
var cipher = await _cipherRepository.GetFullDetailsByIdAsync(cipherId, userId);
|
||||
var cipher = await _cipherRepository.GetByIdAsync(cipherId, userId);
|
||||
if(cipher == null)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var collectionCiphers = await _collectionCipherRepository.GetManyByUserIdCipherIdAsync(userId, cipherId);
|
||||
return new CipherFullDetailsResponseModel(cipher, collectionCiphers);
|
||||
return new CipherDetailsResponseModel(cipher, collectionCiphers);
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
|
@ -41,16 +41,16 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public async Task<LoginDetailsResponseModel> Get(string id)
|
||||
public async Task<LoginResponseModel> Get(string id)
|
||||
{
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var login = await _cipherRepository.GetFullDetailsByIdAsync(new Guid(id), userId);
|
||||
var login = await _cipherRepository.GetByIdAsync(new Guid(id), userId);
|
||||
if(login == null || login.Type != Core.Enums.CipherType.Login)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var response = new LoginDetailsResponseModel(login);
|
||||
var response = new LoginResponseModel(login);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user