Marketplace Add-Ons

How to Contribute a New "User Registration Request" Document Type

Updated: July 17, 2023

If you want to define other request metadata that should be filled in when inviting users to a workspace, you need to contribute a new user registration document type to the Nuxeo Platform User Registration add-on. This can be done using an XML contribution.

Pre requisites

You have already defined a new user registration document type as described in How to Define a Document Type with the following items and values:

  • A new schema custom-userinfo that must have at least the following attributes:
Attribute NameType
login
string
firstName
string
lastName
string
company
string
email
string
groups
string, Multi-Valued
  • The schema registration, added in Settings > Registries > Document Schemas:

    {
      schemas: {
        registration: {
          @prefix: "registration",
          validationMethod: "string",
          copyTo: "string",
          comment: "string",
          accepted: "boolean"
        }
      }
    }
    

    The registration schema is required to add other fields used by the user registration feature.

  • A Document type name MyCustomUserRegistration, with both schemas custom-userinfo and registration.

Step 1: Adding a Reference to Your Component Which Defines Your Document Type

Nested the component tag of your XML contribution file,  add first a require tag to reference your document type definition

 <require>studio.extensions.my-studio-project</require>

Step 2: Contributing Your Document Type to the User Registration Configuration

Use the extension point configuration to register your new document type, schema and fields in the user registration service.

<extension target="org.nuxeo.ecm.user.registration.UserRegistrationService"
    point="configuration">
    <configuration merge="true">
        <requestDocType>MyCustomUserRegistration</requestDocType>
        <userInfo>
          <schemaName>custom-userinfo</schemaName>
          <usernameField>custom-userinfo:login</usernameField>
          <emailField>custom-userinfo:email</emailField>
          <firstnameField>custom-userinfo:firstName</firstnameField>
          <lastnameField>custom-userinfo:lastName</lastnameField>
          <groupsField>custom-userinfo:groups</groupsField>
          <companyField>custom-userinfo:company</companyField>
        </userInfo>
    </configuration>
</extension>

You're done. All default FreeMarker templates will use dynamically your fields, so you don't have to contribute new templates.