cancel
Showing results for 
Search instead for 
Did you mean: 

Adding colums to the default user schema

a_c
Confirmed Champ
Confirmed Champ

Hello community, I'm trying to add more fields to the user creation form. I've been following the tutorial at https://doc.nuxeo.com/nxdoc/how-to-add-new-fields-to-the-user-profile-or-group-profile/ Where it shows how to override the default user schema. I followed suit and added my custom user schema as well as the references contribution as shown. I also modified the edit user layout to add my custom fields (they are simple nuxeo-inputs with the new user fields as values).

However whenever I create or edit an user, those fields are never persisted; looking at the database those fields/columns are also missing. I checked the server logs as well and found that the schema manager actually marks my custom schema as registered.

Is there another configuration that s missing? I'd appreciate any help

1 ACCEPTED ANSWER

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello

Here is what has to be done to update the user profile.

Studio side

  1. use the XSD file (for example my_custom_user.xsd) from the user schema (see documentation above) as a basis and keep the namespace, etc.
  2. add the fields you want
  3. head over to CONFIGURATION / Resources / Schemas
  4. import the XSD file
  5. go to CONFIGURATION / Advanced Settings / XML Extensions
  6. add the following configuration:
<extension point="schema" target="org.nuxeo.ecm.core.schema.TypeService">
  <!-- override default user schema -->
  <schema name="user" override="true" src="data/schemas/my_custom_user.xsd"/>
</extension>
  1. to double-check those steps were effective, you can go check into your database that the fields are indeed present in the users table after synching your project server-side and restarting Nuxeo.

Web UI side

After checking the code, you will need to:

  1. override the nuxeo-edit-user.html element by writing a custom element:
    /> https://github.com/nuxeo/nuxeo-ui-elements/blob/maintenance-2.4.x/nuxeo-user-group-management/nuxeo-...
    /> adding the field(s) you just added to the schema
  2. override the nuxeo-create-user element
    /> https://github.com/nuxeo/nuxeo-ui-elements/blob/maintenance-2.4.x/nuxeo-user-group-management/nuxeo-...
    /> so that it uses the custom element based on nuxeo-edit-user
  3. override the nuxeo-user-group-management element
    /> https://github.com/nuxeo/nuxeo-ui-elements/blob/maintenance-2.4.x/nuxeo-user-group-management.html
    /> so that it uses the custom element based on nuxeo-create-user
  4. override the nuxeo-user-group-management-page
    /> https://github.com/nuxeo/nuxeo-web-ui/blob/10.10/elements/nuxeo-admin/nuxeo-user-group-management-pa...
    /> so that it uses the custom element based on nuxeo-user-group-management
  5. then you will be able to override the ADMINISTRATION_PAGES slot in nuxeo--custom-bundle.html
    /> so that it uses your overriden version of the nuxeo-user-group-management-page element.
    /> (in Studio you can find it in Designer / RESOURCES / UI)
    /> For reference the original slot definition is defined here:
    /> https://github.com/nuxeo/nuxeo-web-ui/blob/10.10/elements/nuxeo-web-ui-bundle.html#L27

View answer in original post

2 REPLIES 2

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello

Here is what has to be done to update the user profile.

Studio side

  1. use the XSD file (for example my_custom_user.xsd) from the user schema (see documentation above) as a basis and keep the namespace, etc.
  2. add the fields you want
  3. head over to CONFIGURATION / Resources / Schemas
  4. import the XSD file
  5. go to CONFIGURATION / Advanced Settings / XML Extensions
  6. add the following configuration:
<extension point="schema" target="org.nuxeo.ecm.core.schema.TypeService">
  <!-- override default user schema -->
  <schema name="user" override="true" src="data/schemas/my_custom_user.xsd"/>
</extension>
  1. to double-check those steps were effective, you can go check into your database that the fields are indeed present in the users table after synching your project server-side and restarting Nuxeo.

Web UI side

After checking the code, you will need to:

  1. override the nuxeo-edit-user.html element by writing a custom element:
    /> https://github.com/nuxeo/nuxeo-ui-elements/blob/maintenance-2.4.x/nuxeo-user-group-management/nuxeo-...
    /> adding the field(s) you just added to the schema
  2. override the nuxeo-create-user element
    /> https://github.com/nuxeo/nuxeo-ui-elements/blob/maintenance-2.4.x/nuxeo-user-group-management/nuxeo-...
    /> so that it uses the custom element based on nuxeo-edit-user
  3. override the nuxeo-user-group-management element
    /> https://github.com/nuxeo/nuxeo-ui-elements/blob/maintenance-2.4.x/nuxeo-user-group-management.html
    /> so that it uses the custom element based on nuxeo-create-user
  4. override the nuxeo-user-group-management-page
    /> https://github.com/nuxeo/nuxeo-web-ui/blob/10.10/elements/nuxeo-admin/nuxeo-user-group-management-pa...
    /> so that it uses the custom element based on nuxeo-user-group-management
  5. then you will be able to override the ADMINISTRATION_PAGES slot in nuxeo--custom-bundle.html
    /> so that it uses your overriden version of the nuxeo-user-group-management-page element.
    /> (in Studio you can find it in Designer / RESOURCES / UI)
    /> For reference the original slot definition is defined here:
    /> https://github.com/nuxeo/nuxeo-web-ui/blob/10.10/elements/nuxeo-web-ui-bundle.html#L27

Thank you so much for your answer.

Getting started

Attention: Blogs & Forums are in READ-ONLY mode from Oct 6-19 as we transition to our new platform. Learn more.

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.