lsc icon indicating copy to clipboard operation
lsc copied to clipboard

Modify the behaviour of createValues and defaultValues

Open davidcoutadeur opened this issue 2 years ago • 1 comments

This is a major change, and should be tagged for version 2.2.

Currently, the behaviour is:

<createValues/> 	
If: 
* no <forceValues/> are specified, 
* no values are read from the source, and
* a new entry is being added, 
THEN the attribute will be created with values from <createValues/> 

<defaultValues/>
If: 
* no <forceValues/> are specified, 
* no values are read from the source, and 
* the attribute doesn't yet exist in the destination, 
THEN it is created in an existing entry with values from <defaultValues/>

Here is a problematic use case:

  • set up a createValues with a fixed userPassword string
  • build another attribute, for example hashedPassword = sha(userPassword). This implies to define userPassword as source fetched attribute.

The fixed userPassword string won't be taken in consideration because userPassword has been declared as a source attribute.

I propose to remove the condition: no values are read from the source.

To obtain the same behaviour, admins can simply use javascript to test the presence of the source attribute:

srcBean.getDatasetFirstValueById("userPassword");

davidcoutadeur avatar Jun 06 '23 17:06 davidcoutadeur

See also https://github.com/lsc-project/lsc/issues/216

davidcoutadeur avatar Jun 06 '23 17:06 davidcoutadeur