A requirement of the system I'm working on is that no single user can login multiple times. Each user has a password. What's the best way to implement this?
Setup a daily login/logout table, check for existing UserId and if found() show the user the door, otherwise append new record with UserId, and allow access.
Jim,
One way to do this is to maintain a record for each user. When they login, have the program lock this record (you'll have to keep this file open for the "duration". If the same user tries to login again they won't be able to get this lock. If the user's system crashes, then the server will release the lock when it decides the connection has been servered (how long depends on the file server's OS and the appropriate configuration options).
To go little deeper into suggestion rgbeen's suggestion...
I am using a similar approach with much more functionalities
1. I open an invisible form for this purpose with a private data session at the beginning just after login with parameters of login ..
2. Open the Password file in the DE.
3. Check for the user/password and lock the record.
4. Dont release the form which is invisible. Continue with other forms etc. and release it only at the end of the application.
You can have a field for flaging with operation type. For example - data backup, restore, period end processing etc. operations are done after writing a flag in the flag field. This helps to let know all users some system operations status. Also helps to stop any user from loging in. This I do by locking all records for critical system operations or warning to avoid doing such critical activities, if others are loged in.
So mutiple purpose can be achieved in this way. In fact I use this for much more functions not explained here.
Hope this gives you some more insight into this thinking and I have been of some help to you.
Thanks Gregore Dolghin. Let me try it out and feel my preference. I have done that invisible form and feel absolutely solid in that. More over that form gets copied to every project I develop and I am very comfortable with it. Your idea is noted. Thanks again. ramani
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
<snip> 1. I open an invisible form for this purpose with a private data session
Ramani,
SP3 introduced the Session class for exactly that purpose. Flexibility of a private data session w/o the overhead of a form.
Grigore,
I believe the reason Ramani chose to use a form is because it provides a private data session. The DataEnvironment class doesnt provide this functionality; hence it always opens in the datasession that is current when it is created. Jon Hawkins
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.