Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the actual domain username in the user model #795

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions Bonobo.Git.Server/Data/ADBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private UserModel GetUserModelFromPrincipal(UserPrincipal user)
result = new UserModel
{
Id = user.Guid.Value,
Username = user.UserPrincipalName,
Username = user.SamAccountName + "@" + user.Context.Name,
GivenName = user.GivenName ?? String.Empty,
Surname = user.Surname ?? String.Empty,
Email = user.EmailAddress ?? String.Empty,
Expand Down Expand Up @@ -170,15 +170,12 @@ private void UpdateUsers()
{
Users.Remove(Id);
}
foreach (string username in group.GetMembers(true).OfType<UserPrincipal>().Select(x => x.UserPrincipalName).Where(x => x != null))
foreach (UserPrincipal principal in group.GetMembers(true).OfType<UserPrincipal>())
{
using (var principal = ADHelper.GetUserPrincipal(username))
UserModel user = GetUserModelFromPrincipal(principal);
if (user != null)
{
UserModel user = GetUserModelFromPrincipal(principal);
if (user != null)
{
Users.AddOrUpdate(user);
}
Users.AddOrUpdate(user);
}
}
}
Expand Down Expand Up @@ -232,7 +229,7 @@ private void UpdateRoles()
{
Roles.Remove(role.Id);
}

foreach (string roleName in ActiveDirectorySettings.RoleNameToGroupNameMapping.Keys)
{
string groupName = ActiveDirectorySettings.RoleNameToGroupNameMapping[roleName];
Expand Down