Nuxeo Server

How to Add New Fields to the User Profile or Group Profile

Updated: November 13, 2017 Page Information Edit on GitHub

This page is scheduled for review and update. Check back soon for updated content!

Users and groups profile are defined by schemas. The default user schema is:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:nxs="http://www.nuxeo.org/ecm/schemas/user"
    targetNamespace="http://www.nuxeo.org/ecm/schemas/user">

  <xs:include schemaLocation="base.xsd" />

  <xs:element name="username" type="xs:string" />
  <xs:element name="password" type="xs:string" />
  <xs:element name="email" type="xs:string" />
  <xs:element name="firstName" type="xs:string" />
  <xs:element name="lastName" type="xs:string" />
  <xs:element name="company" type="xs:string" />

  <xs:element name="petName" type="xs:string" />

  <!-- inverse reference -->
  <xs:element name="groups" type="nxs:stringList" />

</xs:schema>

It is displayed in the Nuxeo Platform like this:

If you want to add more fields than the default ones on the user profile, you can simply override the definition of the schema user (in a Studio project or in an XML component in nxserver/config).

<extension point="schema" target="org.nuxeo.ecm.core.schema.TypeService">
    <<!-- override default user schema -->
    <schema name="user" override="true" src="schemas/my_custom_user_schema.xsd"/>
</extension>

Note that you can contribute a new schema with Nuxeo Studio. The default one is:

As you see, you should not forget the inverse reference field.

You then have to update the forms used for editing the user profile (to be documented).

It works the same for the group schema, and you have to make sure to have some mandatory fields available for references and inverse references for the group hierarchy. See default one:

<?xml version="1.0"?>

<xs:schema targetNamespace="http://www.nuxeo.org/ecm/schemas/group"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:nxs="http://www.nuxeo.org/ecm/schemas/group">

  <xs:include schemaLocation="base.xsd" />

  <xs:element name="groupname" type="xs:string" />
  <xs:element name="grouplabel" type="xs:string" />
  <xs:element name="description" type="xs:string" />

  <!-- references -->
  <xs:element name="members" type="nxs:stringList" />
  <xs:element name="subGroups" type="nxs:stringList" />

  <!-- inverse reference -->
  <xs:element name="parentGroups" type="nxs:stringList" />

</xs:schema>

That can be contributed with the following extension:

 <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
  <schema name="group" src="directoryschema/group.xsd"/>
</extension>

4 days ago manonlumeau Added content-review-lts2017 label
a month ago manonlumeau NXDOC-1346-FT review screenshot
History: Created by manonlumeau