Hi Bernd,
I did this in a simple way years ago at a client using Servoy 5.2 Smart Client
Basically, you need to still use the Servoy Web Admin page to create users and passwords & assign groups.
Create users with the same name as their Windows log in name and give them a password in there that can access Servoy.
Then also create a table in your own solution as a 'lookup table' (you may already have something like this), with the user's name, login name & password (make sure this table is secure).
Then in the 'authentication' module you get the username and then check if it is in your lookup table and then use Servoy to log them in...
Code for startup method in login module
- Code: Select all
function crm_login ()
{
var $user = security.getSystemUserName() ;
security.authenticate('__crm_authenticator','crm_authenticate',[$user]) ;
}
Code in Authenticator Module
- Code: Select all
/**
* @param {String} $userName
*/
function crm_authenticate ($userName)
{
globals._user = $userName;
var success = false;
if ( utils.hasRecords ( user_to_employees ) ) // relationship based on globals._user -> system_user_name in employees table which is their Windows login name
{
var uid = security.getUserUID ( user_to_employees.username );
var ds_groups = security.getUserGroups ( uid );
var arr_groups = new Array ( );
if ( ds_groups != null )
for ( k = 1; k <= ds_groups.getMaxRowIndex ( ); k++ )
{
arr_groups.push ( ds_groups.getValue ( k, 2 ) );
}
success = security.login ( user_to_employees.username, uid, arr_groups );
}
else
{
message ( 'no match in employees table' + ' ' )
}
return success;
}
and I have a form that displays some error text about failed login in the authenticator module & set as first form for the main solution, which would only actually be seen if login failed
Hope this helps, let me know if you need more
Rafi