API add-on bug with password CATG
we are importing data to i-doit using API, now we need to use te password category (C__CATG__PASSWD) but the password attribute cannot be written.
So if you try the api:
- when you fetch data from i-doit you can read all the attributes including passwords (ciphered string)
- when you try to add a password using api you get the following error:
Internal error: There was an validation error [password: (password) Unable to retrieve corresponding validator for property type 'password']
Also when you go to i-doit gui config to see "Categories and attributes" if you fetch data for password category you get this (password attribute doens't have "Data type (write)"):
When we go deep into code to know the source of this problem we found two problems:
- C__PROPERTY__INFO__TYPE__PASSWORD is not mapped in PropertyWriteEntityDefinition. We solved it adding the following code to src/classes/modules/api/src/Property/PropertyWriteEntityDefinition.php at line 88:
case C__PROPERTY__INFO__TYPE__PASSWORD: $propertyEntity = new PropertyWriteEntity('Text', 'Example text value'); $propertyEntity->addDefinition('string', 'Valid string value with maximum 255 characters.', 'Example text value'); break;
After that, if you check other time the attributes from passwords category at gui now password attribute have string as "Data type (write)":
- C__PROPERTY__INFO__TYPE__PASSWORD is not mapped in PropertyValidationFactory. We solved it adding the following code to src/classes/modules/api/src/Validation/PropertyValidationFactory.php at line 46:
C__PROPERTY__INFO__TYPE__PASSWORD => Text::class,
After that, we can use API to push passwords (ciphered) into i-doit.
unfortunately nobody answered yet...
Thank you for the hint.