Authentication issue: 'Can't find security.login method'

In developing a simple authentication method that uses Servoy’s internal security, I have the following code in the authenicator solution:

function login(userName, password) {
   var userUID = security.getUserUID(userName);
   if (security.checkPassword(userUID, password)) {
      var ug = security.getUserGroups(userUID)
      var entry = security.login(userName, userUID, ug)
      return entry
   }
   else return false;
}

In Developer debug mode the login solution login form appears. On typing a correct user and password, the debugger appears to show valid arguments for security.login, but then fails at the line ‘var entry = security.login…’.

The error begins 'Can’t find method com.servoy.j2db.scripting.JSSecurity.js_login(string,string,com.servoy.j2db.dataprocessing.BufferedDataSet). (/[path to authentication solution in workspace].globals.js:8 (login)

Is this a coding problem or bug? I am a newbie to Servoy’s enhanced security, so I blame myself for falling into this one.

The relevant section of servoy_log.txt is attached.

Servoy 5.2.1 (new install) on Mac OS X 10.6.4

servoy_log.txt (2.79 KB)

Solved. The error was a result of my incomplete understanding of the security node. The call to security.login(userName, userID, ug) failed owing to the dimensionality of the ‘ug’ array.

Setting variable ug to security.getUserGroups(userUID) results in a two dimensional array, such as row 1: ‘1’, ‘Administrators’; row 2: ‘2’, ‘Managers’.

In testing, I found that by setting the variable ug to a one-dimensional array I could get a working login. The needed column of the ‘UserGroups’ array is the second.

The critical code lines become:

ug = security.getUserGroups(userUID).getColumnAsArray(2)
var entry = security.login(userName, userUID, ug)