1. mathews rutto
  2. PowerBuilder
  3. Tuesday, 20 April 2021 09:38 AM UTC

Hi,

How to disable one person /user to concurrently login from different machines?

Thank you in advance

mike S Accepted Answer Pending Moderation
  1. Wednesday, 21 April 2021 13:09 PM UTC
  2. PowerBuilder
  3. # 1

for PostgreSQL take a look at pg_stat_activity:

select usename , usesysid , application_name , client_hostname  
from pg_stat_activity

 

 

Comment
  1. mathews rutto
  2. Thursday, 22 April 2021 14:10 PM UTC
Thank you let me try out this one
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 20 April 2021 15:33 PM UTC
  2. PowerBuilder
  3. # 2

What database?

SQL Server has optional dbparms Host and Appname that you can set when logging in.

This SQL statement will tell you how many copies of the app are running on another machine.

SELECT count(*) INTO :li_appcount
  FROM master.sys.sysprocesses
WHERE hostname <> 'my computer' AND program_name = 'my program';

 

Comment
  1. mathews rutto
  2. Wednesday, 21 April 2021 06:01 AM UTC
Am using PostgreSQL.
  1. Helpful
There are no comments made yet.
Matt Balent Accepted Answer Pending Moderation
  1. Tuesday, 20 April 2021 15:31 PM UTC
  2. PowerBuilder
  3. # 3

Assuming you connect to a database when you log on to your application you can track the connection (insert a row into a table) for that userid.  As part of the log on process you then query that table to see if the user is logged on and prevent them if they are.  HOWEVER, you need to have some sort of process of clearing entries from this table should the user drop network connectivity, shut off the PC, or some other type of situation which prevents the application from clearing their entry from the table as part of a 'normal' exiting of the program.  In MS SQL Server you can also track the users via various system procedures and do the same (prevent simultaneous connections) but these may not work if you have permissions locked down.

Comment
  1. mathews rutto
  2. Wednesday, 21 April 2021 06:11 AM UTC
Thank you. actually have tried your option where i created a table to insert record of user log in. Now the issue still having is to record user log out entry when there is network drop, PC shut down...etc. For a normal log out i can achieve. Am using posgreSQL database.
  1. Helpful
  1. Markus Eckert
  2. Wednesday, 21 April 2021 09:54 AM UTC
You can also have the new instance of the program "hijack" the session, and then disable the old instance.



For that you'd need to remember your login time and then periodically (for example via a timer event on your main window) check if your session still has the same login_time. If not, you can disable / close / whatever the current program.



That way you can make sure that your users can always open a new instance of your program (even if the old instance crashed) and you have the side benefits that your users don't have to access their other computer to close the previous session. (Imagine someone at the office finding out that they've left the program running on their computer at home)
  1. Helpful
There are no comments made yet.
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Tuesday, 20 April 2021 13:31 PM UTC
  2. PowerBuilder
  3. # 4

Hi mathews,

I think you'll need to be (a lot) more specific. Log into what, exactly? A PB application? What kind of app are we talking about?

Comment
  1. mathews rutto
  2. Tuesday, 20 April 2021 14:10 PM UTC
The application am talking about is powerbuilder Application (coded with powerscript).

What i want to archive is when user log into application it's get the machine ip when same user log in again using a different machine ip concurrently system admin can disable the user from accessing the application.

Hope have put it clear now.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.