Admin:
- POST /api/admin/users/{userId}/impersonate – erstellt Token für Zieluser
- Login-as-Button (fa-sign-in) in User-Liste (nicht für sich selbst)
- confirm-Dialog, danach location.reload() mit neuem User-Kontext
- Default-Path Feld + Browse-Button im Admin-Formular
Default-Path:
- Neues Feld default_path in users-Tabelle (TryAddColumn Migration)
- UserRecord.DefaultPath Property
- In allen Endpoints: Admin CRUD, Auth /me, Profile Get/Update
- Profil-Seite: Default-Path Feld + Browse-Button
- Session-Seite: Workspace-Browse nutzt defaultPath als Fallback
26 lines
761 B
C#
26 lines
761 B
C#
namespace Gott.Models;
|
|
|
|
public class UserRecord
|
|
{
|
|
public int Id { get; set; }
|
|
public string UserId { get; set; }
|
|
public string Username { get; set; }
|
|
public string PasswordHash { get; set; }
|
|
public string DisplayName { get; set; }
|
|
public string CreatedAt { get; set; }
|
|
public string UpdatedAt { get; set; }
|
|
public bool IsAdmin { get; set; }
|
|
public string Persona { get; set; }
|
|
public string Settings { get; set; }
|
|
public string DefaultPath { get; set; }
|
|
|
|
public string GetEffectivePersona()
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(Persona))
|
|
return Persona;
|
|
|
|
var name = !string.IsNullOrWhiteSpace(DisplayName) ? DisplayName : Username;
|
|
return $"Mein Name ist **{name}**.";
|
|
}
|
|
}
|