Hi,

 
your Javascript part is indeed correct and functional (the LSC part indeed 
contains some minor errors). 

I do get an LDAP error however, and I think this is related to the fact that 
the Javascript creates a dotted value like:

 
6987.0

 
When I enter a value directly (without a Javascript) this also is transfomerd 
to the same string with ".0" concatenated.

 
Why is this, and more importantly: how can this be avoided? Should I use 
another tag than "string"? 

 
 
Met Vriendelijke Groet,
Kind Regards,
Salutations,
 
 
Bart Coninckx
Bits 'n Tricks BVBA
 
Hoge Mierdse Heide 182
2360 Oud-Turnhout
tel. +32 14 480 820

gsm +32 478 88 33 08
[email protected]
http://www.bitsandtricks.com
BTW: BE0817.401.875

Crelan BE46 8601 0806 3436

Voor onze Algemene Voorwaarden, zie: 
http://www.bitsandtricks.com/index.php/contact/algemene-voorwaarden

 

 
-----Original message-----
From:Alexander Herr <[email protected]>
Sent:Wed 04-01-2017 09:36
Subject:Re: [lsc-users] generate a random value for uidNumber
To:General discussions and help for Ldap Synchronization Connector(LSC) - Start 
here! <[email protected]>; 
 
Yes, the uidNumber CAN be random, note however that this number (together with 
the gidNumber) traditionally comes from UNIX’ uid and gid, which can have 
further meanings. For instance, in GNU/Linux regular user accounts have uid’s 
starting at 1000 and every user with a uid < 1000 is a system user. So you 
might want to take care that you do not assign numbers <1000 to regular users. 

 

 
 

AFAICT, only Javascript (and Groovy: 
http://lsc-project.org/wiki/documentation/2.1/scripting/start) is supported. 
However, it is quite easy to achieve what you want using JS:

 

 
 

<dataset>

 

  <name>uidNumber</name>

 

  <policy>KEEP</policy>

 

  <createValues>

 

    <string>js:Math.floor((Math.random() * 9999999) + 1000)</string>

 

 </createValues>

 

</dataset>

 

 
 

This will generate a new uidNumber on user creation as a random number between 
1000 and 9999999 (inclusive). I do not know your usecase and have no idea how 
big uidNumber can be, so you might want to change the numbers. 

 

 
 

Also, I just started with LSC myself, so I might be fuzzy with the correct 
lsc-syntax. The javascript should be correct though. 

 

 
 

Best, 

 

Alex.

 

 
 

 
 

 
 
Von: [email protected] 
[mailto:[email protected]] Im Auftrag von Bart Coninckx
 Gesendet: Dienstag, 3. Januar 2017 22:11
 An: [email protected]
 Betreff: [lsc-users] generate a random value for uidNumber

 

 
 

Hi all,

 

 
 

I am syncing from LDAP to eDirectory with lsc-2.1.3. In the target directory I 
need to add a objectclass which requires the uidNumber property. It is my 
assumption that this value should be unique per directory entry. Ideally a 
random value should be produced in between, let's say, 10000 and 20000. I'm not 
sure how to go about this. From what I read one solution would be to use 
scripting and have Javascript take care of this. I'm not very proficient at 
Javascript, are other scripting languages or bash supported?

 

 
 

Cheers,

 

 
 

Met Vriendelijke Groet,
 Kind Regards,
 Salutations,
  
  
 Bart Coninckx

 

 
 


_______________________________________________________________
 Ldap Synchronization Connector (LSC) - http://lsc-project.org
 
 lsc-users mailing list
 [email protected]
 http://lists.lsc-project.org/listinfo/lsc-users

 
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users

Reply via email to