Example #1
0
        public async Task PutDeleteMany([FromBody] CipherBulkDeleteRequestModel model)
        {
            if (!_globalSettings.SelfHosted && model.Ids.Count() > 500)
            {
                throw new BadRequestException("You can only delete up to 500 items at a time.");
            }

            var userId = _userService.GetProperUserId(User).Value;
            await _cipherService.SoftDeleteManyAsync(model.Ids.Select(i => new Guid(i)), userId);
        }
        public async Task DeleteMany([FromBody] CipherBulkDeleteRequestModel model)
        {
            if (model.Ids.Count() > 500)
            {
                throw new BadRequestException("You can only delete up to 500 items at a time. " +
                                              "Consider using the \"Purge Vault\" option instead.");
            }

            var userId = _userService.GetProperUserId(User).Value;
            await _cipherService.DeleteManyAsync(model.Ids.Select(i => new Guid(i)), userId);
        }
Example #3
0
        public async Task PutDeleteManyAdmin([FromBody] CipherBulkDeleteRequestModel model)
        {
            if (!_globalSettings.SelfHosted && model.Ids.Count() > 500)
            {
                throw new BadRequestException("You can only delete up to 500 items at a time.");
            }

            if (model == null || string.IsNullOrWhiteSpace(model.OrganizationId) ||
                !_currentContext.OrganizationAdmin(new Guid(model.OrganizationId)))
            {
                throw new NotFoundException();
            }

            var userId = _userService.GetProperUserId(User).Value;
            await _cipherService.SoftDeleteManyAsync(model.Ids.Select(i => new Guid(i)), userId, new Guid(model.OrganizationId), true);
        }
Example #4
0
 public async Task DeleteMany([FromBody] CipherBulkDeleteRequestModel model)
 {
     var userId = _userService.GetProperUserId(User).Value;
     await _cipherService.DeleteManyAsync(model.Ids.Select(i => new Guid(i)), userId);
 }