User schema#
Users in Plone have a set of properties defined by a default set of fields such as fullname
, email
, portrait
, and so on.
These properties define the site user's profile and the user itself via the Plone UI, or the site managers can add them in a variety of ways including PAS plugins.
These fields are dynamic and customizable by integrators so they do not adhere to a fixed schema interface. This dynamic schema is exposed by this endpoint in order to build the user's profile form and the registration form.
Get the schema for the user profile#
To get the current schema for the user profile, make a request to the /@userschema
endpoint.
http
GET /plone/@userschema HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
curl
curl -i -X GET http://nohost/plone/@userschema -H "Accept: application/json" --user admin:secret
httpie
http http://nohost/plone/@userschema Accept:application/json -a admin:secret
python-requests
requests.get('http://nohost/plone/@userschema', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
The server will respond with the user profile schema.
HTTP/1.1 200 OK
Content-Type: application/json
{
"fieldsets": [
{
"behavior": "plone",
"fields": [
"fullname",
"email",
"home_page",
"description",
"location",
"portrait"
],
"id": "default",
"title": "Default"
}
],
"properties": {
"description": {
"description": "\n A short overview of who you are and what you do. Will be displayed on your author page, linked from the items you create.\n ",
"factory": "Text",
"title": "Biography",
"type": "string",
"widget": "textarea"
},
"email": {
"description": "We will use this address if you need to recover your password",
"factory": "Email",
"title": "Email",
"type": "string",
"widget": "email"
},
"fullname": {
"description": "Enter full name, e.g. John Smith.",
"factory": "Text line (String)",
"title": "Full Name",
"type": "string"
},
"home_page": {
"description": "\n The URL for your external home page, if you have one.\n ",
"factory": "URL",
"title": "Home page",
"type": "string",
"widget": "url"
},
"location": {
"description": "\n Your location - either city and country - or in a company setting, where your office is located.\n ",
"factory": "Text line (String)",
"title": "Location",
"type": "string"
},
"portrait": {
"description": "\n To add or change the portrait: click the \"Browse\" button; select a picture of yourself. Recommended image size is 75 pixels wide by 100 pixels tall.\n ",
"factory": "Image",
"properties": {
"portrait.contentType": {
"default": "",
"description": "The content type identifies the type of data.",
"factory": "Text line (String)",
"title": "Content Type",
"type": "string"
},
"portrait.data": {
"default": "",
"description": "The actual content of the object.",
"factory": "Text line (String)",
"title": "Data",
"type": "string"
},
"portrait.filename": {
"description": "",
"factory": "Text line (String)",
"title": "Filename",
"type": "string"
}
},
"title": "Portrait",
"type": "object"
}
},
"required": [
"email"
],
"type": "object"
}
The user schema uses the same serialization as the type's JSON schema.
See Types Schema for detailed documentation about the available field types.
Get the registration form#
In Plone you can configure each of the fields of the user schema to be available in only one of either the user profile form or registration form, or in both of them.
To get the user schema available for the user registration form, make a request to the @userschema/registration
endpoint.
http
GET /plone/@userschema/registration HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
curl
curl -i -X GET http://nohost/plone/@userschema/registration -H "Accept: application/json" --user admin:secret
httpie
http http://nohost/plone/@userschema/registration Accept:application/json -a admin:secret
python-requests
requests.get('http://nohost/plone/@userschema/registration', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
The server will respond with the user schema for registration.
HTTP/1.1 200 OK
Content-Type: application/json
{
"fieldsets": [
{
"behavior": "plone",
"fields": [
"fullname",
"email",
"username",
"password",
"password_ctl",
"mail_me"
],
"id": "default",
"title": "Default"
}
],
"properties": {
"email": {
"description": "We will use this address if you need to recover your password",
"factory": "Email",
"title": "Email",
"type": "string",
"widget": "email"
},
"fullname": {
"description": "Enter full name, e.g. John Smith.",
"factory": "Text line (String)",
"title": "Full Name",
"type": "string"
},
"mail_me": {
"default": false,
"description": "",
"factory": "Yes/No",
"title": "Send a confirmation mail with a link to set the password",
"type": "boolean"
},
"password": {
"description": "Enter your new password.",
"factory": "Password",
"title": "Password",
"type": "string",
"widget": "password"
},
"password_ctl": {
"description": "Re-enter the password. Make sure the passwords are identical.",
"factory": "Password",
"title": "Confirm password",
"type": "string",
"widget": "password"
},
"username": {
"description": "Enter a user name, usually something like 'jsmith'. No spaces or special characters. Usernames and passwords are case sensitive, make sure the caps lock key is not enabled. This is the name used to log in.",
"factory": "Text line (String)",
"title": "User Name",
"type": "string"
}
},
"required": [
"email",
"username",
"password",
"password_ctl"
],
"type": "object"
}
The user schema uses the same serialization as the type's JSON schema.