- This topic has 7 replies, 2 voices, and was last updated 3 years, 1 month ago by
kimbomadsen.
-
AuthorPosts
-
-
February 27, 2022 at 00:42 #56280
Babis MichaelParticipantHello,
AuthorizationManager.Logout(const ALoginToken:string) doesn’t provide the TkbmMWAuthorizationContext information as
TkbmMWAuthorizationManager.Logout(const AActor:TkbmMWAuthorizationActor) does needed by the Logout2 event
of TkbmMWAuthorizationManager!Copied and modified a bit the code from TkbmMWAuthorizationManager.Logout(const AActor:TkbmMWAuthorizationActor)
and it works!procedure TkbmMWAuthorizationManager.Logout(const ALoginToken:string);
var
ctx:TkbmMWAuthorizationContext;
l:TkbmMWAuthorizationLogin;
begin
ctx:=TkbmMWAuthorizationContext.Create;
try
FLock.BeginWrite;
try
l:=FLogins.Get(ALoginToken);
ctx.Token:=l.Token;
ctx.ActorName:=l.Actor.Name;
ctx.Role:=l.Role;
ctx.Login:=l;
DoOnLogout(ctx);
ctx.TraceMessage:=’Logout: LoginToken=’+ctx.Token;
DoOnTrace(ctx);
FLogins.Delete(l.Actor);
finally
FLock.EndWrite;
end;
finally
ctx.Free;
end;
end;Thank you
-
February 27, 2022 at 00:50 #56281
Babis MichaelParticipantbtw, GarbageCollect calls the TkbmMWAuthorizationManager.Logout(const ALoginToken:string);
-
March 28, 2022 at 17:52 #56343
kimbomadsen
KeymasterHi
There will be an additional set of events which will include the context.
The first context less event will be called first, then the event with context./Kim
-
March 29, 2022 at 04:07 #56355
Babis MichaelParticipantHello!
No it doesn’t not! It’s empty and never fills!
As you can see in the code it only assigns the “Token” compared to Logout(const AActor:TkbmMWAuthorizationActor);procedure TkbmMWAuthorizationManager.Logout(const ALoginToken:string);
…
ctx:=TkbmMWAuthorizationContext.Create;
try
ctx.Token:=ALoginToken; //Only this!!!
FLock.BeginWrite;
try
DoOnLogout(ctx);
….procedure TkbmMWAuthorizationManager.Logout(const AActor:TkbmMWAuthorizationActor);
….
ctx.Token:=l.Token;
ctx.ActorName:=AActor.Name;
ctx.Role:=l.Role;
ctx.Login:=l;
DoOnLogout(ctx);
….The ctx information is needed for login2 and logout2 and trace2 of AuthorizationManager!
So in case that GarbageCollection Logout out the user i use the CTX to retrieve his informations. (eg the Actorname).Thank you
-
This reply was modified 3 years, 9 months ago by
Babis Michael.
-
This reply was modified 3 years, 9 months ago by
Babis Michael.
-
This reply was modified 3 years, 9 months ago by
-
-
April 9, 2022 at 02:31 #56410
Babis MichaelParticipantUP
-
April 19, 2022 at 11:55 #56431
Babis MichaelParticipantNew code to avoid AV:
ctx.Token:=ALoginToken;
FLock.BeginWrite;
try
l:=FLogins.Get(ALoginToken); // Newif Assigned(l) then // New
begin
ctx.Token:=l.Token;
ctx.ActorName:=l.Actor.Name;
ctx.Role:=l.Role;
ctx.Login:=l;
end;DoOnLogout(ctx);
ctx.TraceMessage:=’Logout: LoginToken=’+ctx.Token;
DoOnTrace(ctx);FLogins.Delete(l.Actor);
finally
FLock.EndWrite;
end; -
October 31, 2022 at 12:18 #56722
Babis MichaelParticipantKim, this isn’t fixed in 5.20! (you forgot it)
-
November 4, 2022 at 21:05 #56735
kimbomadsen
KeymasterHi,
Will fix in fix release.
/Kim
-
-
AuthorPosts
- You must be logged in to reply to this topic.
