# core.user

# UserModule ⇐ Module

Functions for user-related actions.

Kind: global class
Extends: Module
Since: 0.2.0

# userModule.agreeSitePolicy() ⇒ Promise.<SitePolicyAgreementResponse>

Agrees to the Moodle site policy for the current web service user.

Kind: instance method of UserModule
Returns: Promise.<SitePolicyAgreementResponse> - The response returned by Moodle.
Since: 0.2.0

# userModule.createUsers(...users) ⇒ Promise.<CreateUsersResponse>

Creates users and adds them to the Moodle site.

Kind: instance method of UserModule
Returns: Promise.<CreateUsersResponse> - The response returned by Moodle.
Since: 0.2.0

Param Description
...users The users to create.

# userModule.deleteUsers(...users) ⇒ Promise.<FunctionResponse>

Deletes users from the Moodle site.

Kind: instance method of UserModule
Returns: Promise.<FunctionResponse> - The response returned by Moodle.
Since: 0.2.0

Param Type Description
...users Array.<number> The IDs of the users to delete.

# userModule.getCourseUserProfiles(...users) ⇒ Promise.<GetCourseUserProfilesResponse>

Gets the course profiles for users.

Kind: instance method of UserModule
Returns: Promise.<GetCourseUserProfilesResponse> - The response returned by Moodle.
Since: 0.2.0

Param Type Description
...users Array.<CourseUser> The users (comprising of user ID and course ID) to lookup.

# userModule.getPrivateFilesInfo([user]) ⇒ Promise.<GetPrivateFilesInfoResponse>

Returns general information about files in a user's private files area.

Kind: instance method of UserModule
Returns: Promise.<GetPrivateFilesInfoResponse> - The response returned by Moodle.
Since: 0.2.0

Param Type Description
[user] number The ID of the user to lookup file info on. If none is provided, the ID of the web service user is used.

# userModule.getUserPreferences([name], [user]) ⇒ Promise.<GetUserPreferencesResponse>

Returns user preferences for a Moodle user.

Kind: instance method of UserModule
Returns: Promise.<GetUserPreferencesResponse> - The response returned by Moodle.
Since: 0.2.0

Param Type Description
[name] string The name of the preference to lookup. If none is provided, all preferences are returned.
[user] number The ID of the user to lookup preferences for. If none is provided, the ID of the web service user is used.

# userModule.setUserPreferences(...preferences) ⇒ Promise.<SetUserPreferencesResponse>

Sets user preferences for Moodle users.

Kind: instance method of UserModule
Returns: Promise.<SetUserPreferencesResponse> - The response returned by Moodle.
Since: 0.2.0

Param Type Description
...preferences Array.<NewPreference> The preferences to set.

# userModule.getUsers(...criteria) ⇒ Promise.<GetUsersResponse>

Searches for users on the Moodle site that match the provided crtieria.

Kind: instance method of UserModule
Returns: Promise.<GetUsersResponse> - The response returned by Moodle.
Since: 0.2.0

Param Type Description
...criteria Array.<SearchCriteria> The search criteria used to search for users.

# userModule.getUsersByField(field, ...values) ⇒ Promise.<GetUsersByFieldResponse>

Searches for users on the Moodle site that match a specific field value.

Kind: instance method of UserModule
Returns: Promise.<GetUsersByFieldResponse> - The response returned by Moodle.
Since: 0.2.0

Param Type Description
field "id" | "idnumber" | "username" | "email" The name of the field to search for.
...values The value to search users' fields for.

# userModule.updateUserPicture(draftItemId, [user]) ⇒ Promise.<UserPictureResponse>

Updates a user's profile picture.

Kind: instance method of UserModule
Returns: Promise.<UserPictureResponse> - The response returned by Moodle.
Since: 0.2.0

Param Type Description
draftItemId number The ID of the draft file to use as the picture.
[user] number The ID of the user to update the picture of. If none is provided, the ID of the web service user is used.

# userModule.deleteUserPicture([user]) ⇒ Promise.<UserPictureResponse>

Deletes a user's profile picture.

Kind: instance method of UserModule
Returns: Promise.<UserPictureResponse> - The response returned by Moodle.
Since: 0.2.0

Param Type Description
[user] number The ID of the user to delete the picture of. If none is provided, the ID of the web service user is used.