API add-on bug with password CATG
-
Hi,
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.

-
Hey,
unfortunately nobody answered yet...
Thank you for the hint.
Best
Phil
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login