mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
support access all for collection user details
This commit is contained in:
@ -16,17 +16,20 @@ namespace Bit.Api.Controllers
|
||||
public class CollectionsController : Controller
|
||||
{
|
||||
private readonly ICollectionRepository _collectionRepository;
|
||||
private readonly ICollectionUserRepository _collectionUserRepository;
|
||||
private readonly ICollectionService _collectionService;
|
||||
private readonly IUserService _userService;
|
||||
private readonly CurrentContext _currentContext;
|
||||
|
||||
public CollectionsController(
|
||||
ICollectionRepository collectionRepository,
|
||||
ICollectionUserRepository collectionUserRepository,
|
||||
ICollectionService collectionService,
|
||||
IUserService userService,
|
||||
CurrentContext currentContext)
|
||||
{
|
||||
_collectionRepository = collectionRepository;
|
||||
_collectionUserRepository = collectionUserRepository;
|
||||
_collectionService = collectionService;
|
||||
_userService = userService;
|
||||
_currentContext = currentContext;
|
||||
@ -59,11 +62,12 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("~/collections")]
|
||||
public async Task<ListResponseModel<CollectionResponseModel>> GetUser()
|
||||
public async Task<ListResponseModel<CollectionUserDetailsResponseModel>> GetUser()
|
||||
{
|
||||
var collections = await _collectionRepository.GetManyByUserIdAsync(_userService.GetProperUserId(User).Value);
|
||||
var responses = collections.Select(c => new CollectionResponseModel(c));
|
||||
return new ListResponseModel<CollectionResponseModel>(responses);
|
||||
var collections = await _collectionUserRepository.GetManyDetailsByUserIdAsync(
|
||||
_userService.GetProperUserId(User).Value);
|
||||
var responses = collections.Select(c => new CollectionUserDetailsResponseModel(c));
|
||||
return new ListResponseModel<CollectionUserDetailsResponseModel>(responses);
|
||||
}
|
||||
|
||||
[HttpPost("")]
|
||||
|
Reference in New Issue
Block a user