Shadow user creation

Fields populated for shadow user creation

Field nameDescriptionExample
idRepresent the shadow user id, the same as real user id89e6d798-012f-4005-87da-95a64e8a61f3
usernameCreate using the following pattern: '{{origninalUsername}}_{{random5charactersString}}'mobius_admin_rrjwt
typePopulate with constant value 'shadow'shadow
activePopulate true value true
metadataPopulate common metadata object


Example of shadow user record in DB

{
   "username":"consortia_admin_oyulp",
   "id":"122b3d2b-4788-4f1e-9117-56daa91cb75c",
   "active":true,
   "type":"shadow",
   "departments":[],
   "proxyFor":[],
   "createdDate":"2023-08-01T09:48:59.009+00:00",
   "updatedDate":"2023-08-01T09:48:59.009+00:00",
   "metadata":{
      "createdDate":"2023-08-01T09:48:58.999+00:00",
      "createdByUserId":"6ece8efd-13d8-4ba6-9437-2b2e5a9c6f4a",
      "updatedDate":"2023-08-01T09:48:58.999+00:00",
      "updatedByUserId":"6ece8efd-13d8-4ba6-9437-2b2e5a9c6f4a"
   }
}


Storing originalTenantId field

Currently we are not storing any personal data, a patron group of shadow users, and also filtering out shadow users from search results, but we need to keep linking between shadow and real user.

In order to achieve this we need to store the field originalTenantId in shadow user in some place.

This field can be necessary if we need to get any user's data from a real user if we add some view for displaying shadow users in future on need to use some user's data in reports.

Option to add a new field in the root schema of the user entity can be considered not as the best solution, because this field is needed only for consortia installations.

folio-custom-fields module can be leveraged for this, it has a POST endpoint to populate a custom field type that will be stored in the user entity in DB.

Related story: MODCON-83 - Getting issue details... STATUS