CoolCMS API

UserService extends ApiService
in package
uses SaveTrait

Front service that reads entities through the mapper.

Tags
extends

Table of Contents

Properties

$mapper  : UserMapper

Methods

__construct()  : mixed
activateUser()  : Result
Account activation from the e-mailed link.
cancelDeletion()  : Result
confirmDeletion()  : Result
confirmExternalLink()  : Result
deauthorizeExternal()  : Result
emailExists()  : bool|null
See {@see self::usernameExists()}.
find()  : T|null
Finds one entity by id.
findAll()  : T>, 1: int}
Finds all entities matching the criteria.
findBy()  : T|null
Finds one entity by filters.
findPublicProfile()  : PublicProfile|null
Public profile of another user. Deliberately not through `find()`/`SingleQuery`: `:Api:System:User:get` is admin-only and under `enforce` would take down the anonymous profile page.
findPublicProfiles()  : array<int, PublicProfile>
Bulk variant. Replaces `findAll(['id' => InFilter])` on the admin-only `:Api:System:User:getAll` in comment, review and discussion lists.
getTotalCount()  : int|null
login()  : Result
loginExternal()  : Result
referralOverview()  : Result
Affiliate program for the "My account" page (`:Api:System:User:referralOverview`).
requestDeletion()  : Result
resetPassword()  : Result
revealPhone()  : string
See {@see \App\UI\Front\System\Models\Managers\UserManager::revealPhone()}.
save()  : Result
sendActivationEmail()  : Result
sendNewPassword()  : Result
Replaced `generateNewPassword(int $userId)`, see the repository.
updateColumns()  : Result
updatePassword()  : Result
usernameExists()  : bool|null
Pass-through to the mapper.

Properties

Methods

activateUser()

Account activation from the e-mailed link.

public activateUser(string $email, string $activationKey) : Result
Parameters
$email : string
$activationKey : string
Return values
Result
public confirmExternalLink(string $key) : Result
Parameters
$key : string
Return values
Result

deauthorizeExternal()

public deauthorizeExternal(string $provider, string $externalId) : Result
Parameters
$provider : string
$externalId : string
Return values
Result

emailExists()

See {@see self::usernameExists()}.

public emailExists(string $email[, int|null $excludeId = null ]) : bool|null
Parameters
$email : string
$excludeId : int|null = null
Return values
bool|null

find()

Finds one entity by id.

public find(int $id[, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
$id : int
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T|null

findAll()

Finds all entities matching the criteria.

public findAll([array<string|int, mixed>|null $filters = [] ][, array<string|int, mixed>|null $orderBys = null ][, int|null $offset = null ][, int|null $limit = null ][, array<string|int, mixed>|null $columns = null ][, bool $computeTotalCount = false ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T>, 1: int}
Parameters
$filters : array<string|int, mixed>|null = []
$orderBys : array<string|int, mixed>|null = null
$offset : int|null = null
$limit : int|null = null
$columns : array<string|int, mixed>|null = null
$computeTotalCount : bool = false
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T>, 1: int}

findBy()

Finds one entity by filters.

public findBy([array<string|int, mixed>|null $filters = [] ][, string|array<string|int, mixed>|null $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
$filters : array<string|int, mixed>|null = []
$includes : string|array<string|int, mixed>|null = []
$useCache : bool|null = null
Return values
T|null

findPublicProfile()

Public profile of another user. Deliberately not through `find()`/`SingleQuery`: `:Api:System:User:get` is admin-only and under `enforce` would take down the anonymous profile page.

public findPublicProfile(int $id) : PublicProfile|null
Parameters
$id : int
Return values
PublicProfile|null

findPublicProfiles()

Bulk variant. Replaces `findAll(['id' => InFilter])` on the admin-only `:Api:System:User:getAll` in comment, review and discussion lists.

public findPublicProfiles(array<int, int> $ids) : array<int, PublicProfile>
Parameters
$ids : array<int, int>
Return values
array<int, PublicProfile>

getTotalCount()

public getTotalCount() : int|null
Return values
int|null

login()

public login(string $username, string $password[, string|null $deviceToken = null ]) : Result
Parameters
$username : string
$password : string
$deviceToken : string|null = null
Return values
Result

loginExternal()

public loginExternal(string $provider, string $id, string $email, string $firstname, string $lastname[, bool $emailVerified = false ][, string $referralCode = '' ]) : Result
Parameters
$provider : string
$id : string
$email : string
$firstname : string
$lastname : string
$emailVerified : bool = false
$referralCode : string = ''
Return values
Result

referralOverview()

Affiliate program for the "My account" page (`:Api:System:User:referralOverview`).

public referralOverview(int $userId) : Result
Parameters
$userId : int
Return values
Result

requestDeletion()

public requestDeletion(int $userId, string $password) : Result
Parameters
$userId : int
$password : string
Return values
Result

resetPassword()

public resetPassword(string $email, string $key, string $password) : Result
Parameters
$email : string
$key : string
$password : string
Return values
Result

revealPhone()

See {@see \App\UI\Front\System\Models\Managers\UserManager::revealPhone()}.

public revealPhone(int $id) : string
Parameters
$id : int
Return values
string

save()

public save(BaseEntity $entity[, array<string, mixed> $meta = [] ][, array<int, string> $skipFields = [] ]) : Result
Parameters
$entity : BaseEntity
$meta : array<string, mixed> = []
$skipFields : array<int, string> = []
Return values
Result

sendActivationEmail()

public sendActivationEmail(string $username) : Result
Parameters
$username : string
Return values
Result

sendNewPassword()

Replaced `generateNewPassword(int $userId)`, see the repository.

public sendNewPassword(string $username) : Result
Parameters
$username : string
Return values
Result

updateColumns()

public updateColumns(array<string|int, mixed> $ids, array<string, mixed> $values) : Result
Parameters
$ids : array<string|int, mixed>

ids or composite-id arrays

$values : array<string, mixed>

property name => new value

Return values
Result

updatePassword()

public updatePassword(int $userId, string $currentPassword, string $password) : Result
Parameters
$userId : int
$currentPassword : string
$password : string
Return values
Result

usernameExists()

Pass-through to the mapper.

public usernameExists(string $username[, int|null $excludeId = null ]) : bool|null
Parameters
$username : string
$excludeId : int|null = null
Return values
bool|null —

null = could not be determined, see the repository

On this page

Search results