freeipa-webui icon indicating copy to clipboard operation
freeipa-webui copied to clipboard

[Enhance] Normalize the retrieved 'User' object

Open carma12 opened this issue 1 year ago • 0 comments

Context

The user data ('ipaObject') retrieved from an API call contains partial information and might have some undefined parameters that need to be handled afterward in multiple parts of the code, making it cumbersome to maintain.

That is why a new way to normalize the values (especially the undefined ones) and parse them into a proper data type is needed to better manage the parameters and prevent over-adapting the code to a specific use case.

E.g.: <parameterName>: undefined ---> Needs to be parsed into a specific type (string, number, etc.) to start working with it. If this value is explicitly set as empty ("", 0, etc.), this is considered as a modified value by the current code logic (as per here), but the value has not changed at all (i.e.: no difference between 'undefined' and "").

Goals

  • Normalize the values of the 'User' object to properly detect any change in any of those.

Acceptance criteria

  • Handle the 'User' object retrieved from the API call response.
  • Process the 'User' data and analyze how the types are defined in the global object (i.e.: the 'User' data type).
  • All processed objects need to have all their values/parameters initialized into a specific data type and should be taken as a reference to detect any modification in the fields.
  • Refer to the TypeScript documentation to handle the data types.

carma12 avatar Nov 02 '23 08:11 carma12