Log off users after period of inactivity

Tomas
Member Posts: 420
NAV 4 native database (without job scheduler). No NAS neither.
Any ideas on how to kill nav user sessions without buying additional granules?
Possible ideas:
- disconnect user from network (would user session be killed, or would it remain on nav?)
- write a report that would kill inactive sessions and run it manually when needed (but here, when you need to log on in nav, and there is not enough sessions left, you will not be able to run that report)
- any other ideas?
Any ideas on how to kill nav user sessions without buying additional granules?
Possible ideas:
- disconnect user from network (would user session be killed, or would it remain on nav?)
- write a report that would kill inactive sessions and run it manually when needed (but here, when you need to log on in nav, and there is not enough sessions left, you will not be able to run that report)
- any other ideas?
Tomas,
Dynamics NAV Enthusiast
Dynamics NAV Enthusiast
0
Comments
-
0
-
For a beer...
Users that have Idle timeout field empty, run CU in single instance. See better solution (if possible) at the end of post.OBJECT Codeunit 50004 AutoLogout { OBJECT-PROPERTIES { Date=20.10.07; Time=[ 9:49:19]; Version List=AX064; } PROPERTIES { SingleInstance=Yes; OnRun=BEGIN IF NOT CREATE(Timer) THEN ; Timer.Interval := 60000 ; //1 minute Timer.Enabled := TRUE; Window.OPEN('AutoDisconnect startan!\(window will close automatically)') ; SLEEP(1500) ; Window.CLOSE ; END; } CODE { VAR Timer@1000000000 : Automation "{3B311C81-140E-11D5-8B18-00D0590B4EC5} 1.0:{3B311C92-140E-11D5-8B18-00D0590B4EC5}:'Navision Timer 1.0'.Timer" WITHEVENTS; Sessions@1000000002 : Record 2000000009; users@1000000001 : Record 91; Window@1000000004 : Dialog; EVENT Timer@1000000000::Timer@1(Milliseconds@1000000000 : Integer); BEGIN users.SETFILTER(users."Idle Timeout",'<>''''') ; IF users.FINDFIRST THEN REPEAT Sessions.SETFILTER(Sessions."User ID",'*'+users."User ID") ; IF Sessions.FINDFIRST THEN IF Sessions."Idle Time" > users."Idle Timeout" THEN BEGIN Sessions.DELETE ; MESSAGE('User %1 has been disconnectedafter %2.',users."User ID",users."Idle Timeout") ; END ; UNTIL users.NEXT = 0 ; IF USERID = 'TEST' THEN MESSAGE('Timer dela') ; END; EVENT Timer@1000000000::TimerError@2(ErrorString@1000000000 : Text[1024]); BEGIN END; BEGIN END. } }
Added field in T:91
Field No. Field Name Data Type Length Description
69002 Idle Timeout Duration
Add code in CU:1, in LoginStart... StartOutlookSyncronization; END; IF FORMAT(UserSetup."Idle Timeout") = '' THEN CODEUNIT.RUN(CODEUNIT::AutoLogout) ; //AX064 StartOutlookSyncronization() OLAppMgmt.StartSynchronize; LogInEnd() IF LogInWorkDate <> 0D THEN IF LogInWorkDate = LogInDate THEN ...
It is better to use NAS, since every minute session idle time is reset to zero.
Using NAS idle time of user is not affected.0 -
I understand that it is better to kill sessions using NAS (and easier too), however this time - I need to come up with ideas to do it without NAS.
However, ideas outside of navision doesn't seem to be right.Tomas,
Dynamics NAV Enthusiast0 -
Described solution works without NAS.
But you must left Idle time blank only on users that are working all the time and set Idle time for users that are "distressed" and continuously leave session active.
Forgot to mention, you must add read/delete permission on table Sessions.
You have another way to solve timings.
You can dedicate one user to do disconnects. Use windows Authentication and start fin.exe with Task scheduler. Add wsh script (sendkeys) at the end to close client.
But if no session is available, then the client will stop at error and will not close. Using shell command tasklist /kill (or pslist /kill) before running task will solve that problem.0 -
Malajlo wrote:Described solution works without NAS.
But you must left Idle time blank only on users that are working all the time and set Idle time for users that are "distressed" and continuously leave session active.
Forgot to mention, you must add read/delete permission on table Sessions.
You have another way to solve timings.
You can dedicate one user to do disconnects. Use windows Authentication and start fin.exe with Task scheduler. Add wsh script (sendkeys) at the end to close client.
But if no session is available, then the client will stop at error and will not close. Using shell command tasklist /kill (or pslist /kill) before running task will solve that problem.
Thanks. I will try both of your suggested solutions.Tomas,
Dynamics NAV Enthusiast0 -
Hi, i tried this solution in two customers, and it works fine in one but not in other. Both are working with native db, but one increments the idle time with no limits, and the other when reaches 1 minute resets it to 0. How can this happen? Best regards.0
-
timer triggers after one minute and therefore it sets idle time to zero.
If you test with same username it won't work.
At least one user should do disconnects and others should not.0 -
Hello,
I've tried 1st solution.
But the problem is how can I access to Session Table?
The code unit works, but it doesn't kill the session. I think it is because I didn't do anything with the "Session" table.
Please, advice
Amaraa0 -
Hello,
another option is ExpandIT Client Control: http://www.expandit.com/templates/expan ... log_id=634
But you have to pay for that...
Regards,
Josetxo0 -
I Agree with Josetxo.
I tried it in one customer and runs well. Is easy to configure and manage.
Bye.0 -
Hi guys,
I know there is a tool ExpandIt. But I don't want to pay for this if it is can be done (not so difficult to programm).
I guess there is a solution.
Regards,
Amaraa0 -
another outside option is http://www.autocloseidle.com we use thatAmaraa wrote:I know there is a tool ExpandIt. But I don't want to pay for this if it is can be done (not so difficult to programm).
I guess there is a solution.
ps . sometimes paying for a working solution is far worth the headache of coming up with one.
you'll have to weigh the costs-
sql
sheduler
nas
outside program
**edit : What the list thingy doesn't work? :-k0 -
Savatage wrote:...
-
sql
sheduler
nas
outside program
**edit : What the list thingy doesn't work? :-k- sql
- sheduler
- nas
- outside program
[list] [*]sql [*]sheduler [*]nas [*]outside program[/list]
David Singleton0 -
Amaraa wrote:Hi guys,
I know there is a tool ExpandIt. But I don't want to pay for this if it is can be done (not so difficult to programm).
I guess there is a solution.
Regards,
Amaraa
Amaraa are you an End User or a Partner.
If you are a customer, then you need to understand that people can't develop professional business solutions for free. These products have to be developed tested and supported. If you are a partner, then you need to consider if you are doing your customer a justice. The cost for you to research and analyze then code and test this solution will be far more than the cost of purchasing a ready made product. In the time you waste (and bill the client) for this you could be doing actual business related Navision work.David Singleton0 -
David Singleton wrote:Amaraa wrote:Hi guys,
I know there is a tool ExpandIt. But I don't want to pay for this if it is can be done (not so difficult to programm).
I guess there is a solution.
Regards,
Amaraa
Amaraa are you an End User or a Partner.
If you are a customer, then you need to understand that people can't develop professional business solutions for free. These products have to be developed tested and supported. If you are a partner, then you need to consider if you are doing your customer a justice. The cost for you to research and analyze then code and test this solution will be far more than the cost of purchasing a ready made product. In the time you waste (and bill the client) for this you could be doing actual business related Navision work.
I'm a partner.
And the customer asked to have a tool for auto disconnecting idle users. So, your recommendation is to suggest to the customer buying a tool for that.
I will talk about it with them.0 -
We have a customer licensed for just 4 users, 2 NAS's and 2 clients running SQL 2009R2. They wanted a session kill on a user for 30 miniutes of inactivity. I added some code (see below) to one of the NAS's that we use at not SQL customers running versions 5.1 and 4.3. Code works great. Had an interesting side effect on 2009R2 SQL. After 30 minutes the Session record is deleted if the client was inactive. If 2 users were idle then both session records are deleted allowing another client to connect. The 2 idle sessions appear to the user to be active. When they touch their screen the session record is restablished with no apparent interruption. If both knocked off users touch their screen they are connected. We now have 5 active users (2 NAS and 3 Cleints) while the license clearly only allows 4. If one of the cleints logs off they cannot get back in, they get the standard number of sessions exceeded. It seems like a huge license loop hole. If the seesion records are deleted through the NAS it allows other users to log on but then allows the active clients (whosw sessins records were deleted) to re-establish another session record exceeding the license limit.
session.SETRANGE("My Session",FALSE);
session.SETFILTER(session."Application Name",'%1','Microsoft Dynamics NAV Classic client');
session.SETFILTER(session."Database Name",'%1','ECPNavision');
session.SETFILTER("Idle Time",'>30 min');
IF session.FIND('-') THEN BEGIN
session.DELETE;
MESSAGE('UserID %1 logged off for IDLE time', session."User ID"); // goes to event viewer
COMMIT;
END;0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions