\App\CoreModule\ModelsUserManager

Tool for managing users

Summary

Methods
Properties
Constants
__construct()
changePassword()
editPassword()
delete()
edit()
getCount()
getInfo()
getUsers()
register()
No public properties found
No constants found
No protected methods found
$entityManager
N/A
No private methods found
No private properties found
N/A

Properties

$entityManager

$entityManager : \App\Models\Database\EntityManager

Type

normal — Entity manager

Methods

__construct()

__construct(\App\Models\Database\EntityManager  $entityManager) : mixed

Constructor

Parameters

\App\Models\Database\EntityManager $entityManager

Entity manager

Returns

mixed

changePassword()

changePassword(int  $id, string  $oldPassword, string  $newPassword) : void

Changes the user's password

Parameters

int $id

User ID

string $oldPassword

Old password

string $newPassword

New password

Throws

\App\CoreModule\Exceptions\InvalidPasswordException

editPassword()

editPassword(int  $id, string  $password) : void

Edits rhe user's password

Parameters

int $id

User ID

string $password

New User's password

delete()

delete(int  $id) : void

Deletes the user

Parameters

int $id

User ID

Throws

\App\CoreModule\Exceptions\NonexistentUserException

edit()

edit(int  $id, string|null  $username, string|null  $role, string|null  $language) : void

Edits the user

Parameters

int $id

User ID

string|null $username

New username

string|null $role

New user role

string|null $language

New user's language

Throws

\App\CoreModule\Exceptions\NonexistentUserException
\App\CoreModule\Exceptions\UsernameAlreadyExistsException

getCount()

getCount() : int

Returns user count

Returns

int —

User count

getInfo()

getInfo(int  $id) : array<string,int|string>|null

Returns information about the user

Parameters

int $id

User ID

Returns

array|null —

Information about the user or null

getUsers()

getUsers() : array<int,array<string,int|string>>

Returns all registered users

Returns

array> —

Registered users

register()

register(string  $username, string  $password, string  $role, string  $language) : void

Registers a new user

Parameters

string $username

Username

string $password

Password

string $role

User's role

string $language

User's language

Throws

\App\CoreModule\Exceptions\UsernameAlreadyExistsException