Пример #1
0
        public async Task <AttachmentResponseModel> GetAttachmentData(string id, string attachmentId)
        {
            var userId = _userService.GetProperUserId(User).Value;
            var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), userId);

            return(await _cipherService.GetAttachmentDownloadDataAsync(cipher, attachmentId));
        }
Пример #2
0
        public async Task <AttachmentResponseModel> GetAttachmentData(string id, string attachmentId)
        {
            var userId = _userService.GetProperUserId(User).Value;
            var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), userId);

            var result = await _cipherService.GetAttachmentDownloadDataAsync(cipher, attachmentId);

            return(new AttachmentResponseModel(result.Id, result.Data, result.Cipher, _globalSettings));
        }
Пример #3
0
        public async Task <AttachmentResponseData> GetAttachmentDownloadAsync(Guid id, Guid cipherId, string attachmentId, User requestingUser)
        {
            var emergencyAccess = await _emergencyAccessRepository.GetByIdAsync(id);

            if (!IsValidRequest(emergencyAccess, requestingUser, EmergencyAccessType.View))
            {
                throw new BadRequestException("Emergency Access not valid.");
            }

            var cipher = await _cipherRepository.GetByIdAsync(cipherId, emergencyAccess.GrantorId);

            return(await _cipherService.GetAttachmentDownloadDataAsync(cipher, attachmentId));
        }