class UserContextService (View source)

Constants

EXTERNAL_AUTH_METHODS

Derived from {AuthMethod::isExternal()}; do not list the cases again.

Methods

static void
setApiUserContext(int $userId, string|null $username)

No description

static void
clearApiUserContext()

No description

string|null
getLoggedInUsername()

No description

int|null
getLoggedInUserId()

No description

string|null
getActingUsername()

The name to record as the actor of this request. An API request that also carries a browser session is attributed to the API principal, not the session.

string|null
getDisplayName()

No description

string|null
getAuthMethod()

No description

AuthMethod
getAuthMethodEnum()

The session's auth method as an enum. Unknown or absent reads as SQL.

string|null
getUserEmail()

No description

string|null
getOAuthAvatarUrl()

No description

bool
isAuthenticated()

No description

string|null
getUserLanguage()

No description

void
setUserLanguage(string $language)

No description

bool
hasSessionData(string $key)

No description

mixed
getSessionData(string $key)

No description

void
setSessionData(string $key, mixed $value)

No description

void
unsetSessionData(string $key)

No description

Details

static void setApiUserContext(int $userId, string|null $username)

No description

Parameters

int $userId
string|null $username

Return Value

void

static void clearApiUserContext()

No description

Return Value

void

string|null getLoggedInUsername()

No description

Return Value

string|null

int|null getLoggedInUserId()

No description

Return Value

int|null

string|null getActingUsername()

The name to record as the actor of this request. An API request that also carries a browser session is attributed to the API principal, not the session.

Return Value

string|null

string|null getDisplayName()

No description

Return Value

string|null

string|null getAuthMethod()

No description

Return Value

string|null

AuthMethod getAuthMethodEnum()

The session's auth method as an enum. Unknown or absent reads as SQL.

getAuthMethod() stays for Twig, which compares the raw string.

Return Value

AuthMethod

string|null getUserEmail()

No description

Return Value

string|null

string|null getOAuthAvatarUrl()

No description

Return Value

string|null

bool isAuthenticated()

No description

Return Value

bool

string|null getUserLanguage()

No description

Return Value

string|null

void setUserLanguage(string $language)

No description

Parameters

string $language

Return Value

void

bool hasSessionData(string $key)

No description

Parameters

string $key

Return Value

bool

mixed getSessionData(string $key)

No description

Parameters

string $key

Return Value

mixed

void setSessionData(string $key, mixed $value)

No description

Parameters

string $key
mixed $value

Return Value

void

void unsetSessionData(string $key)

No description

Parameters

string $key

Return Value

void