VuFind API Documentation

UserService extends AbstractDbService
in package
implements DbTableAwareInterface, LoggerAwareInterface, UserServiceInterface, UserSessionPersistenceInterface Uses DbTableAwareTrait, LoggerAwareTrait

Database service for user.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Interfaces, Classes, Traits and Enums

DbTableAwareInterface
Marker interface for classes that depend on the \VuFind\Db\Table\PluginManager
LoggerAwareInterface
UserServiceInterface
Database service interface for users.
UserSessionPersistenceInterface
Interface for persisting user data in the session.

Table of Contents

$tableManager  : PluginManager
Database table plugin manager
$userSessionContainer  : Container
__construct()  : mixed
Constructor
addUserDataToSession()  : void
Update session container to store data representing a user (used by privacy mode).
addUserIdToSession()  : void
Update session container to store user ID (used outside of privacy mode).
clearUserFromSession()  : void
Clear the user data from the session.
createEntity()  : UserEntityInterface
Create a new user entity.
createEntityForUsername()  : UserEntityInterface
Create an entity for the specified username.
deleteUser()  : void
Delete a user entity.
getAllUsersWithCatUsernames()  : array<string|int, UserEntityInterface>
Get all rows with catalog usernames.
getDbTable()  : Gateway
Get a database table object.
getDbTableManager()  : PluginManager
Get the table plugin manager. Throw an exception if it is missing.
getInsecureRows()  : array<string|int, UserEntityInterface>
Get user rows with insecure catalog passwords.
getUserByCatId()  : UserEntityInterface|null
Retrieve a user object by catalog ID. Returns null if no match is found.
getUserByEmail()  : UserEntityInterface|null
Retrieve a user object by email address. Returns null if no match is found.
getUserByField()  : UserEntityInterface|null
Retrieve a user object from the database based on the given field.
getUserById()  : UserEntityInterface|null
Retrieve a user object from the database based on ID.
getUserByUsername()  : UserEntityInterface|null
Retrieve a user object by username. Returns null if no match is found.
getUserByVerifyHash()  : UserEntityInterface|null
Retrieve a user object by verify hash. Returns null if no match is found.
getUserFromSession()  : UserEntityInterface|null
Build a user entity using data from a session container. Return null if user data cannot be found.
hasUserSessionData()  : bool
Is there user data currently stored in the session container?
persistEntity()  : void
Persist an entity.
setDbTableManager()  : void
Set the table plugin manager.
updateUserEmail()  : void
Update the user's email address, if appropriate. Note that this does NOT automatically save the row; it assumes a subsequent call will be made to persist the data.
debug()  : void
Log a debug message.
log()  : void
Send a message to the logger.
logError()  : void
Log an error message.
logWarning()  : void
Log a warning message.

Properties

$userSessionContainer

protected Container $userSessionContainer

Methods

__construct()

Constructor

public __construct(Container $userSessionContainer) : mixed
Parameters
$userSessionContainer : Container

Session container for user data

Return values
mixed

addUserDataToSession()

Update session container to store data representing a user (used by privacy mode).

public addUserDataToSession(UserEntityInterface $user) : void
Parameters
$user : UserEntityInterface

User to store in session.

Tags
throws
Exception
Return values
void

addUserIdToSession()

Update session container to store user ID (used outside of privacy mode).

public addUserIdToSession(int $id) : void
Parameters
$id : int

User ID

Return values
void

clearUserFromSession()

Clear the user data from the session.

public clearUserFromSession() : void
Return values
void

getDbTable()

Get a database table object.

public getDbTable(string $table) : Gateway
Parameters
$table : string

Table to load.

Return values
Gateway

getUserByEmail()

Retrieve a user object by email address. Returns null if no match is found.

public getUserByEmail(string $email) : UserEntityInterface|null
Parameters
$email : string

Email address

Return values
UserEntityInterface|null

getUserByField()

Retrieve a user object from the database based on the given field.

public getUserByField(string $fieldName, int|string|null $fieldValue) : UserEntityInterface|null

Field name must be id, username, email, verify_hash or cat_id.

Parameters
$fieldName : string

Field name

$fieldValue : int|string|null

Field value

Return values
UserEntityInterface|null

getUserByUsername()

Retrieve a user object by username. Returns null if no match is found.

public getUserByUsername(string $username) : UserEntityInterface|null
Parameters
$username : string

Username

Return values
UserEntityInterface|null

getUserByVerifyHash()

Retrieve a user object by verify hash. Returns null if no match is found.

public getUserByVerifyHash(string $hash) : UserEntityInterface|null
Parameters
$hash : string

Verify hash

Return values
UserEntityInterface|null

hasUserSessionData()

Is there user data currently stored in the session container?

public hasUserSessionData() : bool
Return values
bool

updateUserEmail()

Update the user's email address, if appropriate. Note that this does NOT automatically save the row; it assumes a subsequent call will be made to persist the data.

public updateUserEmail(UserEntityInterface $user, string $email[, bool $userProvided = false ]) : void
Parameters
$user : UserEntityInterface

User entity to update

$email : string

New email address

$userProvided : bool = false

Was this email provided by the user (true) or an automated lookup (false)?

Return values
void

debug()

Log a debug message.

protected debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

log()

Send a message to the logger.

protected log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
$level : string

Log level

$message : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = false

Prepend class name to message?

Return values
void

logError()

Log an error message.

protected logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

logWarning()

Log a warning message.

protected logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

Search results