mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Added Users table
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Berufsschule_HAM.Models;
|
||||
|
||||
public class UserModel
|
||||
@@ -5,7 +7,7 @@ public class UserModel
|
||||
public required string Uid { get; set; }
|
||||
public string? Cn { get; set; }
|
||||
public string? Sn { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public UserDescription? Description { get; set; }
|
||||
public string? JpegPhoto { get; set; }
|
||||
public string? Title { get; set; }
|
||||
public string? UserPassword { get; set; }
|
||||
@@ -14,13 +16,28 @@ public class UserModel
|
||||
Uid = ldapData.GetValueOrDefault("uid") ?? throw new ArgumentException("UID is required");
|
||||
Cn = ldapData.GetValueOrDefault("cn");
|
||||
Sn = ldapData.GetValueOrDefault("sn");
|
||||
Description = ldapData.GetValueOrDefault("description");
|
||||
string? description = ldapData.GetValueOrDefault("description");
|
||||
Description = description != null ? JsonSerializer.Deserialize<UserDescription>(description) : null;
|
||||
JpegPhoto = ldapData.GetValueOrDefault("jpegPhoto");
|
||||
Title = ldapData.GetValueOrDefault("title");
|
||||
UserPassword = ldapData.GetValueOrDefault("userPassword");
|
||||
}
|
||||
}
|
||||
|
||||
public class UserDescription
|
||||
{
|
||||
public required string BirthDate { get; set; }
|
||||
public required UserAddress Address { get; set; }
|
||||
public required string Workplace { get; set; }
|
||||
}
|
||||
|
||||
public class UserAddress
|
||||
{
|
||||
public string? City { get; set; }
|
||||
public string? Street { get; set; }
|
||||
public string? StreetNr { get; set; }
|
||||
}
|
||||
|
||||
public class UserAuthenticationResult
|
||||
{
|
||||
public required bool Success;
|
||||
@@ -33,4 +50,14 @@ public enum UserNotAuthenticatedReason
|
||||
InvalidCredentials,
|
||||
UserNotAuthorized,
|
||||
UserLockedOut
|
||||
}
|
||||
|
||||
public class UserTableViewModel
|
||||
{
|
||||
public required string JpegPhoto { get; set; }
|
||||
public required string Uid { get; set; }
|
||||
public required string Title { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public required string Surname { get; set; }
|
||||
public required string Workplace { get; set; }
|
||||
}
|
||||
@@ -21,4 +21,11 @@ public class UsersModifyRequestModel
|
||||
public string? Description { get; set; } = null;
|
||||
public string? JpegPhoto { get; set; } = null;
|
||||
public string? UserPassword { get; set; } = null;
|
||||
}
|
||||
|
||||
public class UsersDeleteRequestModel(bool successful, string exception = "None")
|
||||
{
|
||||
public bool Success { get; set; } = successful;
|
||||
|
||||
public string? Exception { get; set; } = exception;
|
||||
}
|
||||
6
src/Models/UsersViewModel.cs
Normal file
6
src/Models/UsersViewModel.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Berufsschule_HAM.Models;
|
||||
|
||||
public class UsersIndexViewModel
|
||||
{
|
||||
public required IEnumerable<UserTableViewModel> UserTableViewModels { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user