mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 01:22:50 -05:00
user checks on read procs
This commit is contained in:
@ -28,11 +28,11 @@ namespace Bit.Core.Repositories.SqlServer
|
||||
using(var connection = new SqlConnection(ConnectionString))
|
||||
{
|
||||
var results = await connection.QueryAsync<CipherDetails>(
|
||||
$"[{Schema}].[CipherDetails_ReadById]",
|
||||
new { Id = id },
|
||||
$"[{Schema}].[CipherDetails_ReadByIdUserId]",
|
||||
new { Id = id, UserId = userId },
|
||||
commandType: CommandType.StoredProcedure);
|
||||
|
||||
return results.FirstOrDefault(c => c.UserId == userId);
|
||||
return results.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,12 +103,6 @@ namespace Bit.Core.Services
|
||||
throw new BadRequestException(nameof(cipher.OrganizationId));
|
||||
}
|
||||
|
||||
var existingCipher = await _cipherRepository.GetByIdAsync(cipher.Id);
|
||||
if(existingCipher == null || (existingCipher.UserId.HasValue && existingCipher.UserId != userId))
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var subvaultUserDetails = await _subvaultUserRepository.GetPermissionsByUserIdAsync(userId, subvaultIds,
|
||||
cipher.OrganizationId.Value);
|
||||
|
||||
@ -117,7 +111,7 @@ namespace Bit.Core.Services
|
||||
await _cipherRepository.ReplaceAsync(cipher, subvaultUserDetails.Where(s => s.Admin).Select(s => s.SubvaultId));
|
||||
|
||||
// push
|
||||
await _pushService.PushSyncCipherUpdateAsync(cipher);
|
||||
//await _pushService.PushSyncCipherUpdateAsync(cipher);
|
||||
}
|
||||
|
||||
public async Task ImportCiphersAsync(
|
||||
|
Reference in New Issue
Block a user