\App\ConsoleModule\ModelsConsoleUserManager

Tool for managing users from CLI

Summary

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

Properties

$table

$table : \Nette\Database\Table\Selection

Type

\Nette\Database\Table\Selection — Database table selection

Methods

__construct()

__construct(\Nette\Database\Context  $database) : mixed

Constructor

Parameters

\Nette\Database\Context $database

Database context

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

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\UsernameAlreadyExistsException

getInfo()

getInfo(int  $id) : array|null

Gets information about the user

Parameters

int $id

User ID

Returns

array|null —

Information about the user or null

getUsers()

getUsers() : array

Gets 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

getUser()

getUser(string|null  $username) : array|null

Gets information about the user from the username

Parameters

string|null $username

Username

Returns

array|null —

Information about the user

uniqueUserName()

uniqueUserName(string|null  $username) : bool

Checks if the username is unique

Parameters

string|null $username

Username to check

Returns

bool —

Is username unique?

listUserNames()

listUserNames() : array

Lists user names of all webapp's users

Returns

array —

User names of all webapp's users