1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-21 02:33:14 +00:00

sync with user external ids

This commit is contained in:
Kyle Spearrin
2017-05-16 00:11:31 -04:00
parent 37655d0a61
commit c9737dc411
4 changed files with 13 additions and 6 deletions

View File

@@ -684,7 +684,7 @@ namespace Bit.Console
Con.WriteLine("Users:"); Con.WriteLine("Users:");
foreach(var user in result.Users) foreach(var user in result.Users)
{ {
Con.WriteLine(" {0}{1}", user.Email, user.Disabled ? " (disabled)" : null); Con.WriteLine(" {0}{1}", user.Email ?? user.Id, user.Disabled ? " (disabled)" : null);
} }
} }
else else

View File

@@ -34,8 +34,10 @@ namespace Bit.Core.Models
{ {
Email = entry.Email; Email = entry.Email;
Disabled = entry.Disabled; Disabled = entry.Disabled;
ExternalId = entry.Id;
} }
public string ExternalId { get; set; }
public string Email { get; set; } public string Email { get; set; }
public bool Disabled { get; set; } public bool Disabled { get; set; }
} }

View File

@@ -209,7 +209,12 @@ namespace Bit.Core.Services
Disabled = !user.AccountEnabled.GetValueOrDefault(true) Disabled = !user.AccountEnabled.GetValueOrDefault(true)
}; };
if(entry?.Email?.Contains("#") ?? true) object deleted;
if(user.AdditionalData.TryGetValue("@removed", out deleted) && deleted.ToString().Contains("changed"))
{
entry.Disabled = true;
}
else if(!entry.Disabled && (entry?.Email?.Contains("#") ?? true))
{ {
continue; continue;
} }

View File

@@ -91,9 +91,9 @@ namespace Bit.Core.Utilities
foreach(var user in usersInThisGroup) foreach(var user in usersInThisGroup)
{ {
if(!group.Users.Contains(user.Email)) if(!group.Users.Contains(user.Id))
{ {
group.Users.Add(user.Email); group.Users.Add(user.Id);
} }
} }
@@ -101,9 +101,9 @@ namespace Bit.Core.Utilities
{ {
foreach(var user in currentGroupsUsers) foreach(var user in currentGroupsUsers)
{ {
if(!group.Users.Contains(user.Email)) if(!group.Users.Contains(user.Id))
{ {
group.Users.Add(user.Email); group.Users.Add(user.Id);
} }
} }