AuthorizationManager – GetLogin

Home Forums kbmMW AuthorizationManager – GetLogin

Viewing 8 reply threads
  • Author
    Posts
    • #55112
      Babis Michael
      Participant

      Hello Kim,

      Can you please add a overloaded GetLogin function with ActorName,
      RoleName and Location as parameters like the below:

      function TkbmMWAuthorizationManager.GetLogin(AActorName:string;
      ARoleName:string; ALocation:string):TkbmMWAuthorizationLogin;

      Currently you have only to get with LoginToken

      Thank you

    • #55128
      kimbomadsen
      Keymaster

      Hi,

      You can use: authmgr.Logins.Get(AActorName:string; ARoleName:string; ALocation:string) or one of the other functions accessible via the Logins property.

      best regards

      Kim

    • #55138
      Babis Michael
      Participant

      Hello,

      Well since i’m detecting when a connection disconnects (using Server’s trasnport disconnect event) after i logout the user using the following code:

      //I create the actor at login and delete when disconnect/logout in order to save resources
      //FLoginInfo is a record which hold the Actor’s username and RemoteLocation

      vLogin := AuthorizationManager.Logins.Get(FLoginInfo.ActorName, ‘USER’, FLoginInfo.RemoteLocation);

      if Assigned(vLogin) then //Actor is logged but disconnected
      begin
      AuthorizationManager.Logout(vLogin.Token); //Delete the Actor’s login from AuthorizationManager
      AuthorizationManager.DeleteActor(FLoginInfo.ActorName); //Delete the Actor from AuthorizationManager
      end;

      The problem is when a massing drop of connections occurs i get AV on:
      vLogin := AuthorizationManager.Logins.Get(FLoginInfo.ActorName, ‘USER’, FLoginInfo.RemoteLocation);
      on the below line of  TkbmMWAuthorizationLogins.Get:
      if (n.Actor.Name=AActorName) and (n.Role.Name=ARoleName) and (n.Location=ALocation) then

      Like it’s trying to get the AActorName on a non existant Actor. (It does not check if Actor/Role exists ?)

      Any ideas ?

      Thank you

    • #55157
      kimbomadsen
      Keymaster

      Hi,
      Do:

      authmgr.Lock.BeginRead;
      try
      authmgr.logins.Get(….)
      finally
      authmgr.Lock.EndRead;
      end;

      Remember that the vlogin may go missing outside the beginread/endread section, due to other threads playing with the logins simultanously.

    • #55165
      Babis Michael
      Participant

      Hello,
      Nope! if i delete the actor AV will occur! Removing DeleteActor no AV.

      try
      authmgr.logins.Get(….) <– AV here
      authmgr.logout(logintoken); //actor is logged so log him out
      authmgr.deleteactor(actor); // actor is logged out so delete him
      finally
      authmgr.Lock.EndRead;
      end;

      Thank you

    • #55166
      Babis Michael
      Participant

      Below is the correct code:

      authmgr.Lock.BeginRead;
      try
      vlogin := authmgr.logins.Get(….) <– AV here

      if assigned(vlogin) then
      begin
      authmgr.logout(vlogin,logintoken); //actor is logged so log him out
      authmgr.deleteactor(actor); // actor is logged out so delete him
      end;

      finally
      authmgr.Lock.EndRead;
      end;

      btw, shouldn’t the “DeleteActor” logout the user too ?

      Thank you

    • #55174
      kimbomadsen
      Keymaster

      Hi,

      Try to change to BeginWrite/EndWrite instead and see if that solves the issue.

      You could argue that DeleteActor and other Delete statements that removes the prerequisite for a login, should delete login instances. I will look into if it is viable.

      best regards

      Kim/C4D

    • #55176
      Babis Michael
      Participant

      Hello,

      Nope, BeginWrite/EndWrite have the same result. Access violation!
      I think the wrong locks should cause a deadlock and not an Access violation! <g>
      I guess something is trying to acess something that it isn’t there any more after calling deleteactor but i haven’t figure out what!

    • #55185
      Babis Michael
      Participant

      Hello,

      I think i solved the problem! There were a couple machines with the same actorname so it caused the AV on the delete actor! Since i changed the duplicate actor name the AV seems to be gone when deleting the actor!

       

      • #55196
        kimbomadsen
        Keymaster

        Ok.. .so you somehow get both actors (with same name) defined within the same authorization manager instance?
        That could cause some issues, when dropping an actor again based on the name.

Viewing 8 reply threads
  • You must be logged in to reply to this topic.