[Solved] Sign in loop to front end db

dBase, Calc, CSV, MS ACCESS, MySQL, PostgrSQL, OTHER

[Solved] Sign in loop to front end db

Postby gkick » Wed Dec 18, 2019 1:22 pm

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
Last edited by gkick on Mon Dec 30, 2019 9:36 pm, edited 1 time in total.
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
gkick
 
Posts: 292
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

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

Postby Villeroy » Wed Dec 18, 2019 4:01 pm

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.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29709
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby gkick » Thu Dec 19, 2019 11:50 am

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
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
gkick
 
Posts: 292
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

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

Postby Villeroy » Thu Dec 19, 2019 3:15 pm

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.
Attachments
AutoClose.odt
(12.37 KiB) Downloaded 125 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29709
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby gkick » Fri Dec 20, 2019 6:21 am

Thanks, nice one!
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
gkick
 
Posts: 292
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

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

Postby Villeroy » Fri Dec 20, 2019 10:34 am

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   Expand viewCollapse view
e.Source.close()
ThisComponent.close(False)
End Sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29709
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby Villeroy » Fri Dec 20, 2019 12:11 pm

OK, it might work with embedded forms too.
If the Basic is embedded in the db doc:
Code: Select all   Expand viewCollapse view
ThisDatabaseDocument.CurrentController.ActiveConnection.close()
ThisDatabaseDocument.close(False)

The db document closes with all its embedded documents that may be open.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29709
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby gkick » Fri Dec 20, 2019 5:10 pm

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.
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
gkick
 
Posts: 292
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

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

Postby gkick » Sat Dec 21, 2019 6:16 am

@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...
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
gkick
 
Posts: 292
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

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

Postby gkick » Mon Dec 30, 2019 9:35 pm

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
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
gkick
 
Posts: 292
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile


Return to External Data Sources

Who is online

Users browsing this forum: No registered users and 2 guests