Use collection initializers

This commit is contained in:
anomny
2025-10-04 15:11:08 +02:00
parent ef3be7cb41
commit 285a0968ec
3 changed files with 46 additions and 44 deletions

View File

@@ -75,15 +75,17 @@ public class UsersController : Controller
userPassword = "{SHA256}" + Convert.ToBase64String(hashedPassword);
}
LdapAttributeSet attributeSet = new LdapAttributeSet();
attributeSet.Add(new LdapAttribute("objectClass", "inetOrgPerson"));
attributeSet.Add(new LdapAttribute("cn", cn));
attributeSet.Add(new LdapAttribute("sn", sn));
attributeSet.Add(new LdapAttribute("title", title));
attributeSet.Add(new LdapAttribute("uid", uid));
attributeSet.Add(new LdapAttribute("jpegPhoto", jpegPhoto));
attributeSet.Add(new LdapAttribute("description", description));
attributeSet.Add(new LdapAttribute("userPassword", userPassword));
LdapAttributeSet attributeSet =
[
new LdapAttribute("objectClass", "inetOrgPerson"),
new LdapAttribute("cn", cn),
new LdapAttribute("sn", sn),
new LdapAttribute("title", title),
new LdapAttribute("uid", uid),
new LdapAttribute("jpegPhoto", jpegPhoto),
new LdapAttribute("description", description),
new LdapAttribute("userPassword", userPassword),
];
await _ldap.CreateUser(uid, attributeSet);
return true;
}