In TempaltePro Templates there is a variable "LoggedUserName" which is always aligned to Context.LoggedUser.UserName
Some checks failed
TOC Generator / TOC Generator (push) Has been cancelled

This commit is contained in:
Daniele Teti 2024-11-10 22:30:56 +01:00
parent c199449ad5
commit dfd80def94
2 changed files with 4 additions and 2 deletions

View File

@ -180,6 +180,7 @@ begin
begin
lCompiledTemplate.SetData(lPair.Key, ViewModel[lPair.Key]);
end;
lCompiledTemplate.SetData('LoggedUserName', WebContext.LoggedUser.UserName);
end;
lCompiledTemplate.AddFilter('json', DumpAsJSONString);
lCompiledTemplate.AddFilter('count', GetDataSetOrObjectListCount);

View File

@ -513,11 +513,11 @@ type
FCustomData: TMVCCustomData;
procedure SetLoggedSince(const AValue: TDateTime);
procedure SetCustomData(const Value: TMVCCustomData);
function GetIsValid: Boolean;
public
constructor Create;
destructor Destroy; override;
function IsValid: Boolean;
procedure Clear;
procedure SaveToSession(const AWebSession: TMVCWebSession);
@ -528,6 +528,7 @@ type
property LoggedSince: TDateTime read FLoggedSince write SetLoggedSince;
property Realm: string read FRealm write FRealm;
property CustomData: TMVCCustomData read FCustomData write SetCustomData;
property IsValid: Boolean read GetIsValid;
end;
TWebContext = class
@ -2131,7 +2132,7 @@ begin
inherited Destroy;
end;
function TUser.IsValid: Boolean;
function TUser.GetIsValid: Boolean;
begin
Result := (not UserName.IsEmpty) and (LoggedSince > 0);
end;