Community
    • Categories
    • Recent
    • Popular
    • Users
    • Search
    • Register
    • Login

    API add-on bug with password CATG

    Scheduled Pinned Locked Moved Development
    bugmoduleapiproopen
    2 Posts 2 Posters 643 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • bmsoftB Offline
      bmsoft
      last edited by bmsoft

      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)"):
      Screenshot 2019-05-23 at 11.15.10.png

      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)":
      Screenshot 2019-05-23 at 11.13.51.png

      • 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. 🎉 🎉

      1 Reply Last reply Reply Quote 0
      • Philipp HörselmannP Offline
        Philipp Hörselmann
        last edited by

        Hey,
        unfortunately nobody answered yet...
        Thank you for the hint.
        Best
        Phil

        1 Reply Last reply Reply Quote 1
        • First post
          Last post