mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2026-03-22 02:13:13 +00:00
Added LDAP migrations, made CreateObject async, moved LdapOptions to Models, fixed user password not hashed on user creation
This commit is contained in:
16
src/Models/LdapConfigModel.cs
Normal file
16
src/Models/LdapConfigModel.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Berufsschule_HAM.Models;
|
||||
|
||||
public class LdapConfig
|
||||
{
|
||||
public required string Host { get; set; }
|
||||
public int Port { get; set; } = 389;
|
||||
public bool UseSsl { get; set; } = false;
|
||||
public required string BindDn { get; set; }
|
||||
public required string BindPassword { get; set; }
|
||||
public required string BaseDn { get; set; }
|
||||
public string AssetsOu { get; set; } = "ou=assets";
|
||||
public string LocationsOu { get; set; } = "ou=locations";
|
||||
public string UsersOu { get; set; } = "ou=users";
|
||||
public string GroupsOu { get; set; } = "ou=groups";
|
||||
public string MigrationsOu { get; set; } = "ou=migrations";
|
||||
}
|
||||
28
src/Models/MigrationModels.cs
Normal file
28
src/Models/MigrationModels.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Text.Json;
|
||||
using Berufsschule_HAM.Exceptions;
|
||||
|
||||
namespace Berufsschule_HAM.Models;
|
||||
|
||||
public class MigrationModel
|
||||
{
|
||||
public int Version { get; set; }
|
||||
public MigrationModel(Dictionary<string, string> ldapData)
|
||||
{
|
||||
string? description = ldapData.GetValueOrDefault("description");
|
||||
if (description is null)
|
||||
{
|
||||
Version = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MigrationDescriptionModel? descriptionModel = JsonSerializer.Deserialize<MigrationDescriptionModel>(description)
|
||||
?? throw new InvalidMigrationDescriptionModel();
|
||||
Version = descriptionModel.Version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MigrationDescriptionModel
|
||||
{
|
||||
public required int Version { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user