Loading a valueList from DB under enhanced security security

OK,
Implementing enhanced security under 5.2.2. Have created mod_login, which shows a form and mod_authenticator which does then authentication.
Very similar to the example in the Wki:
http://wiki.servoy.com/display/public/D … 1560DB951D

I am trying to load a combobox in the form in the login solution with the names of tenants. This should be similar to the example in the wiki that loads departments. I am getty very confused about what parts of the valuelist load method should be where (ie in which module).
The data from the value-list comes from a database table (eg select name, tenant_id from tenants).

So, in mod_login I have the following code:

var vtenants = security.authenticate(“mod_authenticator”,“getTenants”);
application.setValueListItems(‘Tenants’,vtenants)

In mod_authenticator I have the following code:

function getTenants() {
// TODO Auto-generated method stub
return application.getValueListItems(tenants)
}

and a valuelist called ‘tenants’. The definition of the tenants valuelist in mod_authenticator is against the database.
There is no valuelist defined in mod_login (should there be?)

Needless to say it doesnt work - but probably becuase I dont understand it…first off I cant set the valuelist of the comboxbox to be ‘tenants’ as it doesnt exist in the mod_login solution…so, should the ‘tenants’ valuelist be in the mod_login solution?..but if I put the valuelist in mod_login…then how do I load it with data (from the db query) within mod_authenticator?

Ok worked it out.
The example in the wiki wont work :(
Why - becuase the valuelist in the mod_login and the valuelist in mod_authenticator are both called departments.
and you cant have two value lists with the same name.
So
Create a valuelist in mod_login (empty definition) and a different one in mod_authenticator (with database definition) and then call authenticator from login and use the call to popyulate the valuelist in login…like this:

Call from mod_login (which ahs a valuelist called tenants)
var vtenants = security.authenticate(“mod_authenticator”,“getTenants”);
application.setValueListItems(‘tenants’,vtenants)

Global method in mod_authenticator (which has a valuelist called vtenants)
function getTenants() {
// TODO Auto-generated method stub
return application.getValueListItems(“vtenants”)
}

why would you need different names?
your login solution and your authenticator solution dont need or better should not be modules from each other…
They are 2 completely separate solutions…