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.

ParameterDescription
gthe group the new profile should join
orgthe 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.

ParameterDescription
gthe group the new profile should join
orgthe organisation the membership sits within
fieldsthe 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.

ParameterDescription
gthe group the new profile should join
orgthe organisation the membership sits within
fieldsthe custom field values to store on the membership, keyed by field name
filesthe 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.

ParameterDescription
addressFieldsthe 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.

ParameterDescription
sthe username, also known as the profile name

email(String s)

Returns: ProfileBuilder

Sets the email address for the new profile.

ParameterDescription
sthe 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.

ParameterDescription
sthe plain text password

phone(String s)

Returns: ProfileBuilder

Sets the phone number for the new profile.

ParameterDescription
sthe phone number

nickName(String s)

Returns: ProfileBuilder

Sets the nickname, ie the informal display name, for the new profile.

ParameterDescription
sthe nickname

firstName(String s)

Returns: ProfileBuilder

Sets the first name for the new profile.

ParameterDescription
sthe first name

surName(String s)

Returns: ProfileBuilder

Sets the surname for the new profile.

ParameterDescription
sthe 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.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.