Fix build errors

This commit is contained in:
anomny
2025-10-04 10:38:19 +02:00
parent e102d0048b
commit a34534eb62
2 changed files with 22 additions and 24 deletions

View File

@@ -66,19 +66,18 @@ public class GroupsController : Controller
{ {
description ??= JsonSerializer.Serialize(new GroupPermissions() {Permissions = []}); description ??= JsonSerializer.Serialize(new GroupPermissions() {Permissions = []});
LdapAttributeSet attributeSet = var attributeSet = new LdapAttributeSet();
[ attributeSet.Add(new LdapAttribute("objectClass", "posixGroup"));
new LdapAttribute("objectClass", "posixGroup"), attributeSet.Add(new LdapAttribute("objectClass", "top"));
new LdapAttribute("objectClass", "top"), attributeSet.Add(new LdapAttribute("cn", cn));
new LdapAttribute("cn", cn), attributeSet.Add(new LdapAttribute("gidNumber", gidNumber));
new LdapAttribute("gidNumber", gidNumber), attributeSet.Add(new LdapAttribute(
new LdapAttribute("description", "description",
JsonSerializer.Serialize( JsonSerializer.Serialize(new GroupPermissions()
new GroupPermissions() {
{ Permissions = [.. permissions]
Permissions = [.. permissions] })));
})),
];
await _ldap.CreateGroup(cn, attributeSet); await _ldap.CreateGroup(cn, attributeSet);
return true; return true;
} }

View File

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