Skip to content
Snippets Groups Projects

Fix: Don't set an email to AD if null or whitespace (coscine/issues#780)

Merged Marcel Nellesen requested to merge Hotfix/779-fixADConnection into Sprint/2020-07
1 file
+ 6
2
Compare changes
  • Side-by-side
  • Inline
@@ -123,7 +123,6 @@ namespace Coscine.Api.STS.Security
@@ -123,7 +123,6 @@ namespace Coscine.Api.STS.Security
{
{
using (var newUser = coscineEntry.Children.Add("CN=" + user.Id, "User"))
using (var newUser = coscineEntry.Children.Add("CN=" + user.Id, "User"))
{
{
newUser.Properties["sAMAccountName"].Value = user.Id.ToString().Substring(0, 20);
if (!string.IsNullOrWhiteSpace(user.Givenname))
if (!string.IsNullOrWhiteSpace(user.Givenname))
{
{
newUser.Properties["givenName"].Value = user.Givenname;
newUser.Properties["givenName"].Value = user.Givenname;
@@ -132,8 +131,13 @@ namespace Coscine.Api.STS.Security
@@ -132,8 +131,13 @@ namespace Coscine.Api.STS.Security
{
{
newUser.Properties["sn"].Value = user.Surname;
newUser.Properties["sn"].Value = user.Surname;
}
}
 
if (!string.IsNullOrWhiteSpace(user.EmailAddress))
 
{
 
newUser.Properties["mail"].Value = user.EmailAddress;
 
}
 
 
newUser.Properties["sAMAccountName"].Value = user.Id.ToString().Substring(0, 20);
newUser.Properties["displayName"].Value = user.DisplayName;
newUser.Properties["displayName"].Value = user.DisplayName;
newUser.Properties["mail"].Value = user.EmailAddress ?? "";
newUser.Properties["uid"].Value = user.Id.ToString();
newUser.Properties["uid"].Value = user.Id.ToString();
newUser.Properties["userPrincipalName"].Value = user.Id.ToString() + "@" + Program.Configuration.GetStringAndWait("coscine/local/profilesync/forestname");
newUser.Properties["userPrincipalName"].Value = user.Id.ToString() + "@" + Program.Configuration.GetStringAndWait("coscine/local/profilesync/forestname");
Loading