user_service
class user_service implements user_service_interface
| internal |
User Service.
Provides orchestration logic for user lifecycle operations (create, update, delete). Applies sensible defaults and validation before delegating to the Support layer.
For simple user lookups (get_user, get_user_by_email, etc.) and profile field operations, use the Support layer directly:
Methods
Create a new Moodle user with sensible defaults.
Update an existing Moodle user with validation.
Delete (soft-delete) a user with existence check.
Details
at line 55
int
create_user(stdClass $userobj, bool $updatepassword = false, bool $nologin = false)
Create a new Moodle user with sensible defaults.
Applies default values for auth, confirmed, and mnethostid if not provided, then delegates to the Support layer.
at line 74
bool
update_user(stdClass $userobj, bool $updatepassword = true, bool $triggerevent = true)
Update an existing Moodle user with validation.
Validates that the user ID is present before delegating to Support.
at line 95
bool
delete_user(int $userid)
Delete (soft-delete) a user with existence check.
Verifies the user exists before attempting deletion.