Page 1 of 1

security.getUserUID problem

PostPosted: Mon Oct 24, 2011 8:46 pm
by kurtbleicken
Running into an odd problem. The following code adds a new user to the security system then we are retrieving the UserUid using

var UserUUID = security.getUserUID( UserName )

Everything works perfectly on the development computer and a bona fide UserUid is retrieved. But when the solution is on the server we get a UserUID that is a number like 237. Any thoughts on how to fix this? Thanks in advance. K


var UserName = forms.user_new.userid_calc
var Password = forms.user_new.usr_password
security.createUser( UserName, Password )
var Group = forms.user_new.usr_group
var UserUUID = security.getUserUID( UserName )

Re: security.getUserUID problem

PostPosted: Tue Oct 25, 2011 3:08 pm
by kurtbleicken
More weirdness. Created a new solution with one form. Three form variables, newUser, newPassword and UUIDformvariable


var username = newUser
var password = newPassword
security.createUser( username, password )
var UUID = security.getUserUID( username)
UUIDformvariable = UUID

This generates a proper UUID, 81464CBF-E6FC-4E93-9CE5-34D2DA85C27E in developer

and generates 146 on the server. If you create another new user it will be 147.

Looks like the UUID generator is broken on the server. Any thoughts on how to fix? K

Re: security.getUserUID problem

PostPosted: Tue Oct 25, 2011 4:17 pm
by patrick
In the old times you would get the ID of the user record in the Servoy repository. This was changed because people wanted to be able to manage their own identifiers, wherever they may come from (for example LDAP). So basically the idea is that YOU provide a uid when you create a user (see the last parameter).

Since you do not supply an ID, Servoy server falls back to the old mechanism of giving you the repository ID (an integer). In developer, there is no repository database, so you get a UUID.

Re: security.getUserUID problem

PostPosted: Tue Oct 25, 2011 10:12 pm
by kurtbleicken
Many thanks Patrick. That solves the mystery. K