Authentication and User Management

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

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 used 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>

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>
3 months ago manonlumeau NXDOC-1831: remove opensocial parameters
History: Created by manonlumeau

We'd love to hear your thoughts!

All fields required