Options

Limit Client Logins

eYeeYe Member Posts: 168
Hi,
I'm new to Navision development (3 weeks), is there a way to limit a user to at most 2 logins to server? (Using NAV 3.7)

i.e. Is there a way to see if other sessions are open for the current user?
Because for some reason some users feel the need to open more than 2 sessions. ](*,)
Thanks
Kind Regards,
Ewald Venter

Comments

  • Options
    lzrlzr Member Posts: 264
    If you are using native db you can use Expandit tools for disconnecting them when they have been idle too long.

    If you are using sql db you can find code on mibuso for disconnecting them when they have been idle too long.

    You can check active sessions using database->information->sessions->current sessions. There you can also kick them.
    Navision developer
  • Options
    eYeeYe Member Posts: 168
    Thanks

    The code I got can help, but is there no way to query the Database sessions table with C/AL code?

    What I plan to do is to edit CU 1. When the user logs on and CU 1 executes, check how many times the user is logged on, if more than 2, kill the session.
    Kind Regards,
    Ewald Venter
  • Options
    garakgarak Member Posts: 3,263
    I have solved this (for 4 years) by an customer of mine. Ther it was an 2.6 native DB

    Here the code: This code will close the client.
    in CU 1 LoginStart new Variable (or call a other CU where you have implemented the followiong code)
    
    Variables
    Name	DataType	Subtype	Length
    WSH	Automation	'Windows Script Host Object Model'.WshShell	
    Session	Record	Session	
    
    LoginStart()
    //new Code +
    Session.reset;
    Session.setrange("Benutzer ID",UserID);
    if Session.count > 1 then begin //there is a another session
      CREATE(WSH);
      WSH.SendKeys('%{F4}');
    END;
    //new Code -
    
    
    Do you make it right, it works too!
  • Options
    pduckpduck Member Posts: 147
    You can extend this with a check on a special role, so that some Users are allowed to log in several times. Those who are allowed get an "empty" role called "2NDLOGIN".
    lrc_Session.SETRANGE("User ID", USERID);
    IF lrc_Session.COUNT > 1 THEN BEGIN
      lrc_MemberOf.SETRANGE("User ID", USERID);
      lrc_MemberOf.SETRANGE("Role ID", '2NDLOGIN');
      IF NOT lrc_MemberOf.FIND('-') THEN
        ERROR('Not allowed !!!');
    END;
    
  • Options
    garakgarak Member Posts: 3,263
    You're sure, that this works :?: The user has still a 2 session :!:
    Do you make it right, it works too!
  • Options
    garakgarak Member Posts: 3,263
    also possible with this:

    viewtopic.php?f=5&t=31486
    Do you make it right, it works too!
Sign In or Register to comment.