Page 1 of 1

[Solved] Sign in loop to front end db

Posted: Wed Dec 18, 2019 1:22 pm
by gkick
Hi,

Scenario, a time tracking db with the following options for rollout.

Dedicated old pc at office entrance - Base Front and HSQL Back in standalone mode on same machine, user fronts the login prompt, logs in, has a button to logoff which effectively would execute the sql shutdown command,.....

Or HSQL backend on a file server with db in server mode, user logs in from his workstation, clocks in and terminates the session.
Now the automacro in the splitdb template and or FreeHSQL does all the connection work in the background for standalone.

What I ideally would like to achieve using the first scenario is admin fires up the db in the morning with an empty login prompt, user logs in, does his stuff and once clicking the logout button his session from the backend is terminated and the frontend returns to the blank login screen waiting for the next user.

Is this at all doable ? , because if I rightclick in the db container and change the user name from the database option, base gets angry or better said the jar which can not be found, however if I save and exit and restart with the other user no problem.

Just wondering if its somehow possible to configure some setup to kick the user off and reload the db or form with prompting renewed for a login.
Sort of inclined to think it might be a driver related thing.

In the attachment is a mockup with three users SA no pw, gkick pw =winzi and mark pw=wilson- You may find that the password is not masked, not sure if this a bug with the driver?
It really would not be practical to having restart LO. Obviously the server side poses another issue with the server shutting down once the last connection terminates.
Of course it would also be fantastic if the user could be somehow prompted to set or change his own password like on a LAN/WAN ?

I also would like to take the opportunity to express my sincere gratitude to all of the tireless LO volunteers. You guys just rock !

Seasons Greetings from the other Down Under.

Link to mockup: https://www.dropbox.com/s/g4o03vmrjej3ng6/PLAY.rar?dl=0

Re: Sign in loop to front end db (may be HSQL backend not st

Posted: Wed Dec 18, 2019 4:01 pm
by Villeroy
Even if it were doable somehow, would it solve a serious problem? Sometimes less is more, isn't it? What I find irritating is that your macro somehow modifies the database document even if the logged in user does nothing. The user should never be prompted to save anything except when he leaves a modified row unsaved.

ThisDatabaseDocument.setModified(False) should fix this.

Re: Sign in loop to front end db (may be HSQL backend not st

Posted: Thu Dec 19, 2019 11:50 am
by gkick
Thanks, guess I take this as a no can t be done. If you are referring to the checkorphan macro, thats just a possibility of an enforced business rule

mfg

Re: Sign in loop to front end db (may be HSQL backend not st

Posted: Thu Dec 19, 2019 3:15 pm
by Villeroy
This form asks for closing after 5 seconds of passivity, that is 5 seconds without focus change. Any macro can be stopped by anybody who clicks on the document outside the form and hits Ctrl+Shift+Q.

Re: Sign in loop to front end db (may be HSQL backend not st

Posted: Fri Dec 20, 2019 6:21 am
by gkick
Thanks, nice one!

Re: Sign in loop to front end db (may be HSQL backend not st

Posted: Fri Dec 20, 2019 10:34 am
by Villeroy
It may do what you need if you
-- extract your form as a stand-alone Writer document.
-- add all needed macro code to the stand-alone document
-- increase the seconds and remove the if...else...endif so the loop is followed by the close statement.
-- add a statement to quit the database connection before closing. I think closing a form does document not necessarily close the database connection.
Something like:

Code: Select all

e.Source.close()
ThisComponent.close(False)
End Sub

Re: Sign in loop to front end db (may be HSQL backend not st

Posted: Fri Dec 20, 2019 12:11 pm
by Villeroy
OK, it might work with embedded forms too.
If the Basic is embedded in the db doc:

Code: Select all

ThisDatabaseDocument.CurrentController.ActiveConnection.close()
ThisDatabaseDocument.close(False)
The db document closes with all its embedded documents that may be open.

Re: Sign in loop to front end db (may be HSQL backend not st

Posted: Fri Dec 20, 2019 5:10 pm
by gkick
Thanks, was exploring the manual re closing the active session and shutdown then calling the setup macros again, but it seems the driver remembers the username. Will give your idea a shot this afternoon.

Re: Sign in loop to front end db (may be HSQL backend not st

Posted: Sat Dec 21, 2019 6:16 am
by gkick
@Villeroy
Noops, I think the driver is putting a spanner in the works. Seems to close the connection ok, user no longer shows up in the statusbar but when I call the setup macro from the embedded module it goes straight into the clockin form bypassing the authentication dialog. Even if I change the user "SA" to something else in the setup same thing. Thats probably why I can not use the if user() part to determine which form to open after authentication.
Never mind, we gave it a shot, can´t win them all...

Re: Sign in loop to front end db (may be HSQL backend not st

Posted: Mon Dec 30, 2019 9:35 pm
by gkick
Got it finally using a simple dos batch file.

First I set line 76 of the embedded Setup macro to ThisDatabaseDocument.DataSource.User = ""
On the desktop I place a batchfile containing:

:nextlog
cd\
c:
cd TT\
TimeTracks.odb
goto nextlog

and voila db opens first user logs in and quits, odb fires up again with blank user prompt