1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-23 12:25:16 +01:00

change routing for org import

This commit is contained in:
Kyle Spearrin 2017-09-06 09:06:13 -04:00
parent 95181aef89
commit 06bdda5717

View File

@ -120,18 +120,18 @@ namespace Bit.Api.Controllers
await _cipherService.ImportCiphersAsync(folders, ciphers, model.FolderRelationships);
}
[HttpPost("{orgId}/import")]
public async Task PostImport(string orgId, [FromBody]ImportOrganizationCiphersRequestModel model)
[HttpPost("import-organization")]
public async Task PostImport([FromQuery]string organizationId, [FromBody]ImportOrganizationCiphersRequestModel model)
{
var organizationId = new Guid(orgId);
if(!_currentContext.OrganizationAdmin(organizationId))
var orgId = new Guid(organizationId);
if(!_currentContext.OrganizationAdmin(orgId))
{
throw new NotFoundException();
}
var userId = _userService.GetProperUserId(User).Value;
var collections = model.Collections.Select(c => c.ToCollection(organizationId)).ToList();
var ciphers = model.Logins.Select(l => l.ToOrganizationCipherDetails(organizationId)).ToList();
var collections = model.Collections.Select(c => c.ToCollection(orgId)).ToList();
var ciphers = model.Logins.Select(l => l.ToOrganizationCipherDetails(orgId)).ToList();
await _cipherService.ImportCiphersAsync(collections, ciphers, model.CollectionRelationships, userId);
}