Fluent builder for creating a profile together with its memberships, custom field values and addresses in one go. Obtained from userManager.newProfileBuilder. Chain the property methods to set the username, email, password and names, add memberships and addresses, then call build to create and save everything. Adding a membership is checked for privilege escalation against the current user, so a builder cannot be used to grant a group the caller could not grant directly.
Group: Builders
Methods
membership(Group g, Organisation org) · membership(Group g, Organisation org, Map<String,String> fields) · membership(Group g, Organisation org, Map<String,String> fields, Map<String,FileItem> files) · address(Map<String,String> addressFields) · name(String s) · email(String s) · password(String s) · phone(String s) · nickName(String s) · firstName(String s) · surName(String s) · build()
membership(Group g, Organisation org)
Returns: ProfileBuilder
Adds a membership of the given group within the given organisation to the profile which will be created. Throws if the current user would gain privileges through that group.
| Parameter | Description |
|---|---|
g | the group the new profile should join |
org | the organisation the membership sits within |
membership(Group g, Organisation org, Map<String,String> fields)
Returns: ProfileBuilder
Adds a membership of the given group within the given organisation, together with the custom field values to store on it. Throws if the current user would gain privileges through that group.
| Parameter | Description |
|---|---|
g | the group the new profile should join |
org | the organisation the membership sits within |
fields | the custom field values to store on the membership, keyed by field name |
membership(Group g, Organisation org, Map<String,String> fields, Map<String,FileItem> files)
Returns: ProfileBuilder
Adds a membership of the given group within the given organisation, together with the custom field values and uploaded files to store on it. Throws if the current user would gain privileges through that group.
| Parameter | Description |
|---|---|
g | the group the new profile should join |
org | the organisation the membership sits within |
fields | the custom field values to store on the membership, keyed by field name |
files | the uploaded files to store against file upload fields, keyed by field name |
address(Map<String,String> addressFields)
Returns: ProfileBuilder
Adds an address to be created for the new profile. Recognised keys are addressType, addressLine1, addressLine2, city, postcode, addressState and country. The address type defaults to Home, and the address is skipped at build time if every field except postcode is blank.
| Parameter | Description |
|---|---|
addressFields | the address values keyed by field name |
name(String s)
Returns: ProfileBuilder
Sets the username for the new profile. When a username is given the profile is created with it, otherwise the username is derived from the email address.
| Parameter | Description |
|---|---|
s | the username, also known as the profile name |
email(String s)
Returns: ProfileBuilder
Sets the email address for the new profile.
| Parameter | Description |
|---|---|
s | the email address |
password(String s)
Returns: ProfileBuilder
Sets the initial password for the new profile. It is applied at build time through the password manager, so the account's password policies are enforced.
| Parameter | Description |
|---|---|
s | the plain text password |
phone(String s)
Returns: ProfileBuilder
Sets the phone number for the new profile.
| Parameter | Description |
|---|---|
s | the phone number |
nickName(String s)
Returns: ProfileBuilder
Sets the nickname, ie the informal display name, for the new profile.
| Parameter | Description |
|---|---|
s | the nickname |
firstName(String s)
Returns: ProfileBuilder
Sets the first name for the new profile.
| Parameter | Description |
|---|---|
s | the first name |
surName(String s)
Returns: ProfileBuilder
Sets the surname for the new profile.
| Parameter | Description |
|---|---|
s | the surname |
build()
Returns: Profile
Creates and saves the profile from everything set on the builder - the names, email, phone and password, then each membership with its custom fields and files, then each address. Memberships are created through findOrCreateMembership, so signup logs are written and signup events fire.