VuFind API Documentation

User extends RowGateway
in package
implements UserEntityInterface, DbServiceAwareInterface, DbTableAwareInterface, IdentityInterface Uses DbServiceAwareTrait, DbTableAwareTrait

Row Definition 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

Main Site

Interfaces, Classes, Traits and Enums

UserEntityInterface
Interface for representing a user account record.
DbServiceAwareInterface
Marker interface for classes that depend on the \VuFind\Db\Service\PluginManager
DbTableAwareInterface
Marker interface for classes that depend on the \VuFind\Db\Table\PluginManager
IdentityInterface

Table of Contents

$auth_method  : string|null
$cat_id  : string|null
$cat_pass_enc  : string|null
$cat_password  : string|null
$cat_username  : string|null
$college  : string
$created  : string
$email  : string
$email_verified  : string|null
$firstname  : string
$home_library  : string|null
$id  : int
$last_language  : string
$last_login  : string
$lastname  : string
$major  : string
$pass_hash  : string|null
$password  : string
$pending_email  : string
$user_provided_email  : int
$username  : string|null
$verify_hash  : string
$capabilities  : AccountCapabilities
$config  : Config
VuFind configuration
$dbServiceManager  : PluginManager
Database service plugin manager
$favoritesService  : FavoritesService
$ilsAuthenticator  : ILSAuthenticator
$tableManager  : PluginManager
Database table plugin manager
__construct()  : mixed
Constructor
activateLibraryCard()  : void
Activate a library card for the given username
changeHomeLibrary()  : mixed
Change home library.
checkEmailVerified()  : bool
Check whether the email address has been verified yet.
clearCredentials()  : void
Reset ILS login credentials.
delete()  : int
Destroy the user.
deleteLibraryCard()  : void
Delete library card
formatTagString()  : string
Same as getTagString(), but operates on a list of tags.
getAuthMethod()  : string|null
Get active authentication method (if any).
getCatId()  : string|null
Get catalog id.
getCatPassEnc()  : string|null
Get encrypted catalog password.
getCatPassword()  : string
This is a getter for the Catalog Password. It will return a plaintext version of the password.
getCatUsername()  : string|null
Get catalog username.
getCollege()  : string
Get college.
getCreated()  : DateTime
Created getter
getDbService()  : T
Get a database service object.
getDbServiceManager()  : PluginManager
Get the service plugin manager. Throw an exception if it is missing.
getDbTable()  : Gateway
Get a database table object.
getDbTableManager()  : PluginManager
Get the table plugin manager. Throw an exception if it is missing.
getEmail()  : string
Get email.
getEmailVerified()  : DateTime|null
Get email verification date (or null for unverified).
getFirstname()  : string
Get firstname.
getHomeLibrary()  : string|null
Get home library.
getId()  : int|null
Get identifier (returns null for an uninitialized or non-persisted object).
getLastLanguage()  : string
Get last language.
getLastLogin()  : DateTime
Last login getter
getLastname()  : string
Get lastname.
getLibraryCard()  : UserCard|false
Get library card data
getLibraryCards()  : AbstractResultSet
Get all library cards associated with the user.
getLists()  : AbstractResultSet
Get all of the lists associated with this user.
getListTags()  : array<string|int, mixed>
Get tags assigned by the user to a favorite list.
getMajor()  : string
Get major.
getPasswordHash()  : string|null
Get hashed password. This should only be used when hashing is enabled.
getPendingEmail()  : string
Get pending email.
getPrimaryKeyColumn()  : array<string|int, mixed>
Retrieve primary key information.
getRawCatPassword()  : string|null
Get raw catalog password.
getRawPassword()  : string
Get raw (unhashed) password (if available). This should only be used when hashing is disabled.
getRoles()  : array<string|int, string>|array<string|int, RoleInterface>
Get the list of roles of this identity
getSavedData()  : array<string|int, mixed>
Get information saved in a user's favorites for a particular record.
getTags()  : array<string|int, mixed>
Get a list of all tags generated by the user in favorites lists. Note that the returned list WILL NOT include tags attached to records that are not saved in favorites lists.
getTagString()  : string
Same as getTags(), but returns a string for use in edit mode rather than an array of tag objects.
getUsername()  : string
Get username.
getVerifyHash()  : string
Get verification hash for recovery.
hasUserProvidedEmail()  : bool
Does the user have a user-provided (true) vs. automatically looked up (false) email address?
libraryCardsEnabled()  : bool
Whether library cards are enabled
removeResourcesById()  : void
Given an array of item ids, remove them from all lists
saveCatalogId()  : mixed
Save ILS ID.
saveCredentials()  : void
Save ILS login credentials.
saveEmailVerified()  : mixed
Save date/time when email address has been verified.
saveLibraryCard()  : int
Save library card with the given information
saveResource()  : void
Add/update a resource in the user's account.
setAuthMethod()  : UserEntityInterface
Set active authentication method (if any).
setCatId()  : UserEntityInterface
Catalog id setter
setCatPassEnc()  : UserEntityInterface
Encrypted catalog password setter
setCatUsername()  : UserEntityInterface
Catalog username setter
setCollege()  : UserEntityInterface
Set college.
setConfig()  : void
Configuration setter
setCreated()  : UserEntityInterface
Created setter
setCredentials()  : void
Set ILS login credentials without saving them.
setDbServiceManager()  : void
Set the service plugin manager.
setDbTableManager()  : void
Set the table plugin manager.
setEmail()  : UserEntityInterface
Set email.
setEmailVerified()  : UserEntityInterface
Set email verification date (or null for unverified).
setFirstname()  : UserEntityInterface
Set firstname.
setHasUserProvidedEmail()  : UserEntityInterface
Set the flag indicating whether the email address is user-provided.
setHomeLibrary()  : UserEntityInterface
Home library setter
setLastLanguage()  : UserEntityInterface
Set last language.
setLastLogin()  : UserEntityInterface
Last login setter.
setLastname()  : UserEntityInterface
Set lastname.
setMajor()  : UserEntityInterface
Set major.
setPasswordHash()  : UserEntityInterface
Set hashed password. This should only be used when hashing is enabled.
setPendingEmail()  : UserEntityInterface
Set pending email.
setRawCatPassword()  : UserEntityInterface
Raw catalog password setter
setRawPassword()  : UserEntityInterface
Set raw (unhashed) password (if available). This should only be used when hashing is disabled.
setUsername()  : UserEntityInterface
Username setter
setVerifyHash()  : UserEntityInterface
Set verification hash for recovery.
updateEmail()  : 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.
updateHash()  : bool
Update the verification hash for this user
updateLastLanguage()  : void
Updated saved language
encryptOrDecrypt()  : string|bool
This is a central function for encrypting and decrypting so that logic is all in one location
getUserCardService()  : UserCardServiceInterface
Get a UserCard service object.
passwordEncryptionEnabled()  : bool
Is ILS password encryption enabled?
updateLibraryCardEntry()  : void
Verify that the current card information exists in user's library cards (if enabled) and is up to date.

Properties

$auth_method

public string|null $auth_method

$cat_id

public string|null $cat_id

$cat_pass_enc

public string|null $cat_pass_enc

$cat_password

public string|null $cat_password

$cat_username

public string|null $cat_username

$college

public string $college

$created

public string $created

$email

public string $email

$email_verified

public string|null $email_verified

$firstname

public string $firstname

$home_library

public string|null $home_library

$last_language

public string $last_language

$last_login

public string $last_login

$lastname

public string $lastname

$major

public string $major

$pass_hash

public string|null $pass_hash

$password

public string $password

$pending_email

public string $pending_email

$user_provided_email

public int $user_provided_email

$username

public string|null $username

$verify_hash

public string $verify_hash

$config

VuFind configuration

protected Config $config = null

Methods

activateLibraryCard()

Activate a library card for the given username

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

Library card ID

Tags
throws
LibraryCard
deprecated

Use UserCardServiceInterface::activateLibraryCard()

Return values
void

changeHomeLibrary()

Change home library.

public changeHomeLibrary(string|null $homeLibrary) : mixed
Parameters
$homeLibrary : string|null

New home library to store, or null to indicate that the user does not want a default. An empty string is the default for backward compatibility and indicates that system's default pick up location is to be used

Tags
deprecated

Use ILSAuthenticator::updateUserHomeLibrary()

Return values
mixed

The output of the save method.

checkEmailVerified()

Check whether the email address has been verified yet.

public checkEmailVerified() : bool
Tags
deprecated

Use getEmailVerified()

Return values
bool

clearCredentials()

Reset ILS login credentials.

public clearCredentials() : void
Tags
deprecated

Use setCatUsername(null)->setRawCatPassword(null)->setCatPassEnc(null)

Return values
void

delete()

Destroy the user.

public delete([bool $removeComments = true ][, bool $removeRatings = true ]) : int
Parameters
$removeComments : bool = true

Whether to remove user's comments

$removeRatings : bool = true

Whether to remove user's ratings

Tags
deprecated

Use \VuFind\Account\UserAccountService::purgeUserData()

Return values
int

The number of rows deleted.

deleteLibraryCard()

Delete library card

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

Library card ID

Tags
throws
LibraryCard
deprecated

Use UserCardServiceInterface::deleteLibraryCard()

Return values
void

formatTagString()

Same as getTagString(), but operates on a list of tags.

public formatTagString(array<string|int, mixed> $tags) : string
Parameters
$tags : array<string|int, mixed>

Tags

Tags
deprecated

Use \VuFind\Favorites\FavoritesService::formatTagStringForEditing()

Return values
string

getAuthMethod()

Get active authentication method (if any).

public getAuthMethod() : string|null
Return values
string|null

getCatId()

Get catalog id.

public getCatId() : string|null
Return values
string|null

getCatPassEnc()

Get encrypted catalog password.

public getCatPassEnc() : string|null
Return values
string|null

getCatPassword()

This is a getter for the Catalog Password. It will return a plaintext version of the password.

public getCatPassword() : string
Tags
throws
PasswordSecurity
deprecated

Use ILSAuthenticator::getCatPasswordForUser()

Return values
string

The Catalog password in plain text

getCatUsername()

Get catalog username.

public getCatUsername() : string|null
Return values
string|null

getCollege()

Get college.

public getCollege() : string
Return values
string

getCreated()

Created getter

public getCreated() : DateTime
Return values
DateTime

getDbService()

Get a database service object.

public getDbService(class-string<\VuFind\Db\Service\T> $name) : T
Parameters
$name : class-string<\VuFind\Db\Service\T>

Name of service to retrieve

Tags
template

T

Return values
T

getDbTable()

Get a database table object.

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

Table to load.

Return values
Gateway

getEmail()

Get email.

public getEmail() : string
Return values
string

getEmailVerified()

Get email verification date (or null for unverified).

public getEmailVerified() : DateTime|null
Return values
DateTime|null

getFirstname()

Get firstname.

public getFirstname() : string
Return values
string

getHomeLibrary()

Get home library.

public getHomeLibrary() : string|null
Return values
string|null

getId()

Get identifier (returns null for an uninitialized or non-persisted object).

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

getLastLanguage()

Get last language.

public getLastLanguage() : string
Return values
string

getLastLogin()

Last login getter

public getLastLogin() : DateTime
Return values
DateTime

getLastname()

Get lastname.

public getLastname() : string
Return values
string

getLibraryCard()

Get library card data

public getLibraryCard([int $id = null ]) : UserCard|false
Parameters
$id : int = null

Library card ID

Tags
throws
LibraryCard
deprecated

Use LibraryCardServiceInterface::getOrCreateLibraryCard()

Return values
UserCard|false

Card data if found, false otherwise

getLibraryCards()

Get all library cards associated with the user.

public getLibraryCards() : AbstractResultSet
Tags
throws
LibraryCard
deprecated

Use UserCardServiceInterface::getLibraryCards()

Return values
AbstractResultSet

getLists()

Get all of the lists associated with this user.

public getLists() : AbstractResultSet
Tags
deprecated

Use UserListServiceInterface::getUserListsAndCountsByUser()

Return values
AbstractResultSet

getListTags()

Get tags assigned by the user to a favorite list.

public getListTags(int $listId) : array<string|int, mixed>
Parameters
$listId : int

List id

Tags
deprecated

Use TagServiceInterface::getListTags()

Return values
array<string|int, mixed>

getMajor()

Get major.

public getMajor() : string
Return values
string

getPasswordHash()

Get hashed password. This should only be used when hashing is enabled.

public getPasswordHash() : string|null
Return values
string|null

getPendingEmail()

Get pending email.

public getPendingEmail() : string
Return values
string

getPrimaryKeyColumn()

Retrieve primary key information.

public getPrimaryKeyColumn() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRawCatPassword()

Get raw catalog password.

public getRawCatPassword() : string|null
Return values
string|null

getRawPassword()

Get raw (unhashed) password (if available). This should only be used when hashing is disabled.

public getRawPassword() : string
Return values
string

getRoles()

Get the list of roles of this identity

public getRoles() : array<string|int, string>|array<string|int, RoleInterface>
Return values
array<string|int, string>|array<string|int, RoleInterface>

getSavedData()

Get information saved in a user's favorites for a particular record.

public getSavedData(string $resourceId[, int $listId = null ][, string $source = DEFAULT_SEARCH_BACKEND ]) : array<string|int, mixed>
Parameters
$resourceId : string

ID of record being checked.

$listId : int = null

Optional list ID (to limit results to a particular list).

$source : string = DEFAULT_SEARCH_BACKEND

Source of record to look up

Tags
deprecated

Use UserResourceServiceInterface::getFavoritesForRecord()

Return values
array<string|int, mixed>

getTags()

Get a list of all tags generated by the user in favorites lists. Note that the returned list WILL NOT include tags attached to records that are not saved in favorites lists.

public getTags([string $resourceId = null ][, int $listId = null ][, string $source = null ]) : array<string|int, mixed>
Parameters
$resourceId : string = null

Filter for tags tied to a specific resource (null for no filter).

$listId : int = null

Filter for tags tied to a specific list (null for no filter).

$source : string = null

Filter for tags tied to a specific record source. (null for no filter).

Tags
deprecated

Use TagServiceInterface::getUserTagsFromFavorites()

Return values
array<string|int, mixed>

getTagString()

Same as getTags(), but returns a string for use in edit mode rather than an array of tag objects.

public getTagString([string $resourceId = null ][, int $listId = null ][, string $source = null ]) : string
Parameters
$resourceId : string = null

Filter for tags tied to a specific resource (null for no filter).

$listId : int = null

Filter for tags tied to a specific list (null for no filter).

$source : string = null

Filter for tags tied to a specific record source (null for no filter).

Tags
deprecated

Use \VuFind\Favorites\FavoritesService::getTagStringForEditing()

Return values
string

getUsername()

Get username.

public getUsername() : string
Return values
string

getVerifyHash()

Get verification hash for recovery.

public getVerifyHash() : string
Return values
string

hasUserProvidedEmail()

Does the user have a user-provided (true) vs. automatically looked up (false) email address?

public hasUserProvidedEmail() : bool
Return values
bool

libraryCardsEnabled()

Whether library cards are enabled

public libraryCardsEnabled() : bool
Tags
deprecated

use \VuFind\Config\AccountCapabilities::libraryCardsEnabled()

Return values
bool

removeResourcesById()

Given an array of item ids, remove them from all lists

public removeResourcesById(array<string|int, mixed> $ids[, string $source = DEFAULT_SEARCH_BACKEND ]) : void
Parameters
$ids : array<string|int, mixed>

IDs to remove from the list

$source : string = DEFAULT_SEARCH_BACKEND

Type of resource identified by IDs

Tags
deprecated

Use \VuFind\Favorites\FavoritesService::removeUserResourcesById()

Return values
void

saveCatalogId()

Save ILS ID.

public saveCatalogId(string $catId) : mixed
Parameters
$catId : string

Catalog ID to save.

Tags
throws
PasswordSecurity
deprecated

Use UserEntityInterface::setCatId() and \VuFind\Db\Service\DbServiceInterface::persistEntity()

Return values
mixed

The output of the save method.

saveCredentials()

Save ILS login credentials.

public saveCredentials(string $username, string $password) : void
Parameters
$username : string

Username to save

$password : string

Password to save

Tags
throws
PasswordSecurity
deprecated

Use ILSAuthenticator::saveUserCatalogCredentials()

Return values
void

saveEmailVerified()

Save date/time when email address has been verified.

public saveEmailVerified([string $datetime = null ]) : mixed
Parameters
$datetime : string = null

optional date/time to save.

Tags
deprecated

Use UserEntityInterface::setEmailVerified() and \VuFind\Db\Service\DbServiceInterface::persistEntity()

Return values
mixed

The output of the save method.

saveLibraryCard()

Save library card with the given information

public saveLibraryCard(int $id, string $cardName, string $username, string $password[, string $homeLib = '' ]) : int
Parameters
$id : int

Card ID

$cardName : string

Card name

$username : string

Username

$password : string

Password

$homeLib : string = ''

Home Library

Tags
throws
LibraryCard
deprecated

Use UserCardServiceInterface::persistLibraryCardData()

Return values
int

Card ID

saveResource()

Add/update a resource in the user's account.

public saveResource(Resource $resource, UserList $list, array<string|int, mixed> $tagArray, string $notes[, bool $replaceExisting = true ]) : void
Parameters
$resource : Resource

The resource to add/update

$list : UserList

The list to store the resource in.

$tagArray : array<string|int, mixed>

An array of tags to associate with the resource.

$notes : string

User notes about the resource.

$replaceExisting : bool = true

Whether to replace all existing tags (true) or append to the existing list (false).

Tags
deprecated

Use \VuFind\Favorites\FavoritesService::saveResourceToFavorites()

Return values
void

setAuthMethod()

Set active authentication method (if any).

public setAuthMethod(string|null $authMethod) : UserEntityInterface
Parameters
$authMethod : string|null

New value (null for none)

Return values
UserEntityInterface

setConfig()

Configuration setter

public setConfig(Config $config) : void
Parameters
$config : Config

VuFind configuration

Tags
deprecated
Return values
void

setCredentials()

Set ILS login credentials without saving them.

public setCredentials(string $username, string|null $password) : void
Parameters
$username : string

Username to save

$password : string|null

Password to save (null for none)

Tags
deprecated

Use ILSAuthenticator::setUserCatalogCredentials()

Return values
void

setEmailVerified()

Set email verification date (or null for unverified).

public setEmailVerified(DateTime|null $dateTime) : UserEntityInterface
Parameters
$dateTime : DateTime|null

Verification date (or null)

Return values
UserEntityInterface

setHasUserProvidedEmail()

Set the flag indicating whether the email address is user-provided.

public setHasUserProvidedEmail(bool $userProvided) : UserEntityInterface
Parameters
$userProvided : bool

New value

Return values
UserEntityInterface

setPasswordHash()

Set hashed password. This should only be used when hashing is enabled.

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

Password hash

Return values
UserEntityInterface

setRawPassword()

Set raw (unhashed) password (if available). This should only be used when hashing is disabled.

public setRawPassword(string $password) : UserEntityInterface
Parameters
$password : string

Password

Return values
UserEntityInterface

updateEmail()

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 updateEmail(string $email[, bool $userProvided = false ]) : void
Parameters
$email : string

New email address

$userProvided : bool = false

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

Tags
deprecated

Use \VuFind\Db\Service\UserServiceInterface::updateUserEmail()

Return values
void

updateHash()

Update the verification hash for this user

public updateHash() : bool
Tags
deprecated

Use \VuFind\Auth\Manager::updateUserVerifyHash()

Return values
bool

save success

updateLastLanguage()

Updated saved language

public updateLastLanguage(string $language) : void
Parameters
$language : string

New language

Tags
deprecated

Use \VuFind\Db\Entity\UserEntityInterface::setLastLanguage() and \VuFind\Db\Service\UserService::persistEntity() instead.

Return values
void

encryptOrDecrypt()

This is a central function for encrypting and decrypting so that logic is all in one location

protected encryptOrDecrypt(string $text[, bool $encrypt = true ]) : string|bool
Parameters
$text : string

The text to be encrypted or decrypted

$encrypt : bool = true

True if we wish to encrypt text, False if we wish to decrypt text.

Tags
throws
PasswordSecurity
deprecated

Use ILSAuthenticator::encrypt() or ILSAuthenticator::decrypt()

Return values
string|bool

The encrypted/decrypted string

passwordEncryptionEnabled()

Is ILS password encryption enabled?

protected passwordEncryptionEnabled() : bool
Tags
deprecated
Return values
bool

updateLibraryCardEntry()

Verify that the current card information exists in user's library cards (if enabled) and is up to date.

protected updateLibraryCardEntry() : void
Tags
throws
PasswordSecurity
deprecated

Use UserCardServiceInterface::synchronizeUserLibraryCardData()

Return values
void

Search results