294 lines
9.4 KiB
C#
294 lines
9.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace gehGassi.Web.Models
|
|
{
|
|
public class ApplicationUserVm
|
|
{
|
|
/// <summary>
|
|
/// Id
|
|
/// </summary>
|
|
[Required(ErrorMessage = "Err_Required")]
|
|
[Display(Name = "ApplicationUser_Id")]
|
|
public string Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Benutzername überschrieben, damit hier eine E-Mail Adresse erzwungen werden kann
|
|
/// </summary>
|
|
[Required(ErrorMessage = "Err_Required")]
|
|
[MaxLength(256, ErrorMessage = "Err_StringLength_Max")]
|
|
[Remote("IsUsernameAvailable", "User", AdditionalFields = "Id", ErrorMessage = "Err_Username_InUse", HttpMethod = "POST")]
|
|
[EmailAddress(ErrorMessage = "Err_InvalidEmail")]
|
|
[Display(Name = "ApplicationUser_UserName")]
|
|
public string UserName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Vorname
|
|
/// </summary>
|
|
[Required(ErrorMessage = "Err_Required")]
|
|
[MaxLength(150, ErrorMessage = "Err_StringLength_Max")]
|
|
[Display(Name = "ApplicationUser_FirstName")]
|
|
public string FirstName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Nachname
|
|
/// </summary>
|
|
[Required(ErrorMessage = "Err_Required")]
|
|
[MaxLength(150, ErrorMessage = "Err_StringLength_Max")]
|
|
[Display(Name = "ApplicationUser_LastName")]
|
|
public string LastName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Id der Timzone (Zeitzone) in welcher der Benutzer sich befindet
|
|
/// </summary>
|
|
[MaxLength(50, ErrorMessage = "Err_StringLength_Max")]
|
|
[Display(Name = "ApplicationUser_TimeZoneId")]
|
|
public string TimeZoneId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Bevorzugte Sprache (ISO2)
|
|
/// </summary>
|
|
[MaxLength(50, ErrorMessage = "Err_StringLength_Max")]
|
|
[Display(Name = "ApplicationUser_PreferredLangauge")]
|
|
public string PreferredLanguage { get; set; }
|
|
|
|
/// <summary>
|
|
/// Zugewiesene Rolle
|
|
/// </summary>
|
|
[Required(ErrorMessage = "Err_Required")]
|
|
[Display(Name = "ApplicationUser_Roles")]
|
|
public List<string> Roles { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional - Foto des Benutzers
|
|
/// </summary>
|
|
[MaxLength(255, ErrorMessage = "Err_StringLength_Max")]
|
|
[Display(Name = "ApplicationUser_Photo")]
|
|
public string Photo { get; set; }
|
|
|
|
/// <summary>
|
|
/// Datum der Registrierung
|
|
/// </summary>
|
|
[Required(ErrorMessage = "Err_Required")]
|
|
[Display(Name = "ApplicationUser_RegistrationDate")]
|
|
public DateTimeOffset RegistrationDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Datum der letzten Anmeldung
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_LastLoginDate")]
|
|
public DateTimeOffset? LastLoginDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Vordefinierte Permissions als packed string.
|
|
/// </summary>
|
|
[MaxLength(500, ErrorMessage = "Err_StringLength_Max")]
|
|
[Display(Name = "ApplicationUser_Permissions")]
|
|
public string Permissions { get; set; }
|
|
|
|
/// <summary>
|
|
/// Id des zugeordneten Kunden.
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_CustomerId", Description = "ApplicationUser_CustomerId_Desc")]
|
|
public long? CustomerId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Name des Kunden
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_CustomerId", Description = "ApplicationUser_CustomerId_Desc")]
|
|
public string CustomerName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Id des App-Users
|
|
/// null, wenn keiner zugeordnet
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_AppUserId", Description = "ApplicationUser_AppUserId_Desc")]
|
|
public string AppUserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Name des App-Users
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_AppUserId", Description = "ApplicationUser_AppUserId_Desc")]
|
|
public string AppUserName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Liste der Rechte
|
|
/// </summary>
|
|
public List<PermissionVm> PermissionVms { get; set; }
|
|
|
|
/// <summary>
|
|
/// Erstellt eine Instanz
|
|
/// </summary>
|
|
public ApplicationUserVm()
|
|
{
|
|
PermissionVms = new List<PermissionVm>();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Erweitert das ApplicationUserVm um PAsswörter für das Anlegen eines Benutzers
|
|
/// </summary>
|
|
public class ApplicationUserCreateVm : ApplicationUserVm
|
|
{
|
|
[Required(ErrorMessage = "Err_Required")]
|
|
[MaxLength(100, ErrorMessage = "Err_StringLength_Max")]
|
|
[DataType(DataType.Password)]
|
|
[Display(Name = "Common_Password")]
|
|
public string Password { get; set; }
|
|
|
|
[DataType(DataType.Password)]
|
|
[Compare("Password", ErrorMessage = "Err_Compare")]
|
|
[Display(Name = "Common_ConfirmPassword")]
|
|
public string ConfirmPassword { get; set; }
|
|
|
|
public ApplicationUserCreateVm() : base()
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Viewmodel für die Listen-Darstellung
|
|
/// </summary>
|
|
public class ApplicationUserListVm
|
|
{
|
|
/// <summary>
|
|
/// Id
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_Id")]
|
|
public string Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Benutzername überschrieben, damit hier eine E-Mail Adresse erzwungen werden kann
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_UserName")]
|
|
public string UserName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Vorname
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_FirstName")]
|
|
public string FirstName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Nachname
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_LastName")]
|
|
public string LastName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gibt an ob ein Benutzer gesperrt ist oder nicht
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_Locked")]
|
|
public bool Locked { get; set; }
|
|
|
|
/// <summary>
|
|
/// Zugewiesene Rolle
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_Roles")]
|
|
public string Roles { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional - Foto des Benutzers
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_Photo")]
|
|
public string Photo { get; set; }
|
|
|
|
/// <summary>
|
|
/// Datum der Registrierung
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_RegistrationDate")]
|
|
public DateTimeOffset RegistrationDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Datum der letzten Anmeldung
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_LastLoginDate")]
|
|
public DateTimeOffset? LastLoginDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Id des zugeordneten Kunden.
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_CustomerId", Description = "ApplicationUser_CustomerId_Desc")]
|
|
public long? CustomerId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Name des Kunden
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_CustomerId", Description = "ApplicationUser_CustomerId_Desc")]
|
|
public string CustomerName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Id des App-Users
|
|
/// null, wenn keiner zugeordnet
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_AppUserId", Description = "ApplicationUser_AppUserId_Desc")]
|
|
public string AppUserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Name des App-Users
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_AppUserId", Description = "ApplicationUser_AppUserId_Desc")]
|
|
public string AppUserName { get; set; }
|
|
|
|
/// <summary>
|
|
/// 2-Faktor Authentifizierung aktiviert?
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_TwoFactorEnabled")]
|
|
public bool TwoFactorEnabled { get; set; }
|
|
|
|
/// <summary>
|
|
/// Email-Adresse bestätigt?
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_EmailConfirmed")]
|
|
public bool EmailConfirmed { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gibt an ob der Benutzer online ist
|
|
/// </summary>
|
|
public bool IsOnline { get; set; }
|
|
|
|
public ApplicationUserListVm()
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Model für das Client-Side Update der BenutzerInfos
|
|
/// </summary>
|
|
public class ApplicationUserInfoVm
|
|
{
|
|
/// <summary>
|
|
/// Benutzername überschrieben, damit hier eine E-Mail Adresse erzwungen werden kann
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_UserName")]
|
|
public string UserName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Vorname
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_FirstName")]
|
|
public string FirstName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Nachname
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_LastName")]
|
|
public string LastName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional - Foto des Benutzers
|
|
/// </summary>
|
|
[Display(Name = "ApplicationUser_Photo")]
|
|
public string Photo { get; set; }
|
|
|
|
/// <summary>
|
|
/// Name für die Darstellung
|
|
/// </summary>
|
|
public string NameForLookup { get; set; }
|
|
}
|
|
}
|