From 8ce0f85fe8af7fab27ec5f0d7803fee1e9141879 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 15 May 2018 08:52:15 -0400 Subject: [PATCH] only impose import limits on cloud version --- src/Api/Controllers/CiphersController.cs | 8 ++++++-- src/Api/Controllers/OrganizationsController.cs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Api/Controllers/CiphersController.cs b/src/Api/Controllers/CiphersController.cs index e82b3d26f9..581f89cda0 100644 --- a/src/Api/Controllers/CiphersController.cs +++ b/src/Api/Controllers/CiphersController.cs @@ -198,7 +198,9 @@ namespace Bit.Api.Controllers [HttpPost("import")] public async Task PostImport([FromBody]ImportCiphersRequestModel model) { - if(model.Ciphers.Count() > 5000 || model.FolderRelationships.Count() > 5000 || model.Folders.Count() > 200) + if(!_globalSettings.SelfHosted && + (model.Ciphers.Count() > 5000 || model.FolderRelationships.Count() > 5000 || + model.Folders.Count() > 200)) { throw new BadRequestException("You cannot import this much data at once."); } @@ -212,7 +214,9 @@ namespace Bit.Api.Controllers [HttpPost("import-organization")] public async Task PostImport([FromQuery]string organizationId, [FromBody]ImportOrganizationCiphersRequestModel model) { - if(model.Ciphers.Count() > 5000 || model.CollectionRelationships.Count() > 5000 || model.Collections.Count() > 200) + if(!_globalSettings.SelfHosted && + (model.Ciphers.Count() > 5000 || model.CollectionRelationships.Count() > 5000 || + model.Collections.Count() > 200)) { throw new BadRequestException("You cannot import this much data at once."); } diff --git a/src/Api/Controllers/OrganizationsController.cs b/src/Api/Controllers/OrganizationsController.cs index 14eaf735e6..36df532126 100644 --- a/src/Api/Controllers/OrganizationsController.cs +++ b/src/Api/Controllers/OrganizationsController.cs @@ -390,7 +390,7 @@ namespace Bit.Api.Controllers [HttpPost("{id}/import")] public async Task Import(string id, [FromBody]ImportOrganizationUsersRequestModel model) { - if(model.Groups.Count() > 200 || model.Users.Count() > 1000) + if(!_globalSettings.SelfHosted && (model.Groups.Count() > 200 || model.Users.Count() > 1000)) { throw new BadRequestException("You cannot import this much data at once."); }