in 2.1b5 you have some sample code now for these functions
jcompagner:
in 2.1b5 you have some sample code now for these functions
Nice! Thanks for the info! I’ve got it figured out (thanks to the great support of pbakker). When’s the release of 2.1b5?
already released!
see latest releases forum!
david:
I have been doing this for a while:(1) show a login page with two global fields for user name and user password.
(2) set your security up as you would normally but don’t require security to open the solution. then take the user to your custom login page on start up.
(3) run this code after the user fills out the two fields:
var ID = security.getUserId(globals.g_user);
var check = security.checkPassword(ID, globals.g_password);
if (check)
{
forms.main_client_list.controller.show();
}
else
{
plugins.dialogs.showErrorDialog(‘Error’, ‘Login incorrect’,‘OK’);
}
(4) to "logout", simply send the user to the login page and clear the two globals. of course you will need to set all forms to non visible so that filling in this login page is the only way into your solution.forms.splash.controller.show();
globals.g_user = ‘’;
globals.g_password = ‘’;
- David
I’m trying to get a handle of the security aspects of Serovy development. Can I check out my understanding of what you have setup here?
It looks to me that your method controlled login compares the user and password entry against Servoy Security users/passwords. Where I get confused is whether this user is really “logged in” according to Servoy Security.
For example, after the user gains access to your solution via this method, do the Form and Table controls assigned to that user in Security apply to the session?
The Servoy Security is NEVER “triggered” unless you show the Servoy Login Dialog. If you use your own login dialog, then the user is NOT seen as “logged in” by Servoy.
I’ve searched the forums, and am posting here, just because it’s the last post I’ve found relating to something close to this.
I can’t seem to determine what users are logged in, because whatever test I use, every user is showing as being logged in.
getUserId states that it will return -1 if the user is not logged in – I get a userid every time for all usernames.
get UserName states that it will return ‘unknown’ if the user is not logged in, but I always get a name for all userids.
getUsers returns all users.
I have solution login required. I have tried this both with developer, and client. I have tried logging in as a non administrator. The only thing that I can think of that I haven’t tried setting is to turn tracking on.
vR2 2.2.4-build336, Java v1.5.0_06-b05 (Windows XP)
Hello rck,
currently there is no direct way of determining all logged in users.
getUserId([userName]) will return the ID of the given userName (no matter if logged in or not) or the ID of the user logged in (if no name is provided). The same goes for getUserName(). As the function says, it will give you the name for the given ID. It doesn’t tell you if that user is logged in.
What most of us do (I suppose ) is an implementation of their own session table. Once a user logs in, you create a new record with login time, name, ID, IP address and whatelse you want to know. If the user logs out, you “check out” that record. That way you can simply query that table and you have all logged in users.
It has also been requested a few times that a Servoy method returns all logged in users, so maybe in a future version you get that.
the getUserId() and getUserName() functions have 2 functions.
1> getUserId() without params will return the current logged in user id or -1 if there was no user id
2> getUserId(name) will give you the id of the user for the given name if the name is found in the user table.
You can’t ask in the client what users are logged on in other clients. Only the current client.
Johan, do you want to say that I express myself a bit too complicate?
you are just to fast.