Loading a valueList from DB under enhanced security security

Questions, tips and tricks and techniques for scripting in Servoy

Loading a valueList from DB under enhanced security security

Postby alb » Sun Oct 31, 2010 7:27 am

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?
alb
 
Posts: 148
Joined: Sun Aug 13, 2006 4:40 am

Re: Loading a valueList from DB under enhanced security security

Postby alb » Sun Oct 31, 2010 7:38 am

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")
}
alb
 
Posts: 148
Joined: Sun Aug 13, 2006 4:40 am

Re: Loading a valueList from DB under enhanced security security

Postby jcompagner » Tue Nov 02, 2010 10:28 am

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...
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Methods

Who is online

Users browsing this forum: No registered users and 5 guests