mirror of
https://github.com/bitwarden/server.git
synced 2024-11-27 13:05:23 +01:00
change routing for org import
This commit is contained in:
parent
95181aef89
commit
06bdda5717
@ -120,18 +120,18 @@ namespace Bit.Api.Controllers
|
|||||||
await _cipherService.ImportCiphersAsync(folders, ciphers, model.FolderRelationships);
|
await _cipherService.ImportCiphersAsync(folders, ciphers, model.FolderRelationships);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("{orgId}/import")]
|
[HttpPost("import-organization")]
|
||||||
public async Task PostImport(string orgId, [FromBody]ImportOrganizationCiphersRequestModel model)
|
public async Task PostImport([FromQuery]string organizationId, [FromBody]ImportOrganizationCiphersRequestModel model)
|
||||||
{
|
{
|
||||||
var organizationId = new Guid(orgId);
|
var orgId = new Guid(organizationId);
|
||||||
if(!_currentContext.OrganizationAdmin(organizationId))
|
if(!_currentContext.OrganizationAdmin(orgId))
|
||||||
{
|
{
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
var userId = _userService.GetProperUserId(User).Value;
|
var userId = _userService.GetProperUserId(User).Value;
|
||||||
var collections = model.Collections.Select(c => c.ToCollection(organizationId)).ToList();
|
var collections = model.Collections.Select(c => c.ToCollection(orgId)).ToList();
|
||||||
var ciphers = model.Logins.Select(l => l.ToOrganizationCipherDetails(organizationId)).ToList();
|
var ciphers = model.Logins.Select(l => l.ToOrganizationCipherDetails(orgId)).ToList();
|
||||||
await _cipherService.ImportCiphersAsync(collections, ciphers, model.CollectionRelationships, userId);
|
await _cipherService.ImportCiphersAsync(collections, ciphers, model.CollectionRelationships, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user