mirror of
https://github.com/bitwarden/server.git
synced 2024-11-26 12:55:17 +01:00
pass orgid from app code rather than querying it
This commit is contained in:
parent
5b5bd4e099
commit
4ab53d476c
@ -42,7 +42,8 @@ namespace Bit.Api.Controllers
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var collectionUsers = await _collectionUserRepository.GetManyDetailsByCollectionIdAsync(collectionIdGuid);
|
||||
var collectionUsers = await _collectionUserRepository.GetManyDetailsByCollectionIdAsync(collection.OrganizationId,
|
||||
collection.Id);
|
||||
var responses = collectionUsers.Select(c => new CollectionUserResponseModel(c));
|
||||
return new ListResponseModel<CollectionUserResponseModel>(responses);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace Bit.Core.Repositories
|
||||
{
|
||||
Task<ICollection<CollectionUser>> GetManyByOrganizationUserIdAsync(Guid orgUserId);
|
||||
Task<ICollection<CollectionUserCollectionDetails>> GetManyDetailsByUserIdAsync(Guid userId);
|
||||
Task<ICollection<CollectionUserUserDetails>> GetManyDetailsByCollectionIdAsync(Guid collectionId);
|
||||
Task<ICollection<CollectionUserUserDetails>> GetManyDetailsByCollectionIdAsync(Guid organizationId, Guid collectionId);
|
||||
Task<bool> GetCanEditByUserIdCipherIdAsync(Guid userId, Guid cipherId);
|
||||
}
|
||||
}
|
||||
|
@ -46,13 +46,14 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<CollectionUserUserDetails>> GetManyDetailsByCollectionIdAsync(Guid collectionId)
|
||||
public async Task<ICollection<CollectionUserUserDetails>> GetManyDetailsByCollectionIdAsync(Guid organizationId,
|
||||
Guid collectionId)
|
||||
{
|
||||
using(var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<CollectionUserUserDetails>(
|
||||
$"[{Schema}].[CollectionUserUserDetails_ReadByCollectionId]",
|
||||
new { CollectionId = collectionId },
|
||||
new { OrganizationId = organizationId, CollectionId = collectionId },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.ToList();
|
||||
|
@ -1,11 +1,10 @@
|
||||
CREATE PROCEDURE [dbo].[CollectionUserUserDetails_ReadByCollectionId]
|
||||
@CollectionId UNIQUEIDENTIFIER
|
||||
@CollectionId UNIQUEIDENTIFIER,
|
||||
@OrganizationId UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
DECLARE @OrganizationId UNIQUEIDENTIFIER = (SELECT [OrganizationId] FROM [dbo].[Collection] WHERE [Id] = @CollectionId)
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
|
Loading…
Reference in New Issue
Block a user