1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

import groups and users for org via api

This commit is contained in:
Kyle Spearrin
2017-05-13 12:00:40 -04:00
parent 5d595d4cf9
commit 0333b47237
6 changed files with 160 additions and 4 deletions

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace Bit.Core.Models.Api
{
public class ImportRequestModel
public class ImportPasswordsRequestModel
{
private LoginRequestModel[] _logins;

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Bit.Core.Models.Api
{
public class ImportOrganizationUsersRequestModel
{
public Group[] Groups { get; set; }
public User[] Users { get; set; }
public class Group
{
[Required]
public string Name { get; set; }
[Required]
public string ExternalId { get; set; }
public Table.Group ToGroup(Guid organizationId)
{
return new Table.Group
{
OrganizationId = organizationId,
Name = Name,
ExternalId = ExternalId
};
}
}
public class User
{
[Required]
[EmailAddress]
public string Email { get; set; }
public IEnumerable<string> ExternalGroupIds { get; set; }
public KeyValuePair<string, IEnumerable<string>> ToKvp()
{
return new KeyValuePair<string, IEnumerable<string>>(Email, ExternalGroupIds);
}
}
}
}