User
extends RowGateway
in package
implements
UserEntityInterface, DbServiceAwareInterface, DbTableAwareInterface, IdentityInterface
Uses
DbServiceAwareTrait, DbTableAwareTrait
Row Definition for user
Tags
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
public
string
$email
$email_verified
public
string|null
$email_verified
$firstname
public
string
$firstname
$home_library
public
string|null
$home_library
$id
public
int
$id
$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
$capabilities
protected
AccountCapabilities
$capabilities
$config
VuFind configuration
protected
Config
$config
= null
$dbServiceManager
Database service plugin manager
protected
PluginManager
$dbServiceManager
$favoritesService
protected
FavoritesService
$favoritesService
$ilsAuthenticator
protected
ILSAuthenticator
$ilsAuthenticator
$tableManager
Database table plugin manager
protected
PluginManager
$tableManager
Methods
__construct()
Constructor
public
__construct(Adapter $adapter, ILSAuthenticator $ilsAuthenticator, AccountCapabilities $capabilities, FavoritesService $favoritesService) : mixed
Parameters
- $adapter : Adapter
-
Database adapter
- $ilsAuthenticator : ILSAuthenticator
-
ILS authenticator
- $capabilities : AccountCapabilities
-
Account capabilities configuration (null for defaults)
- $favoritesService : FavoritesService
-
Favorites service
Return values
mixed —activateLibraryCard()
Activate a library card for the given username
public
activateLibraryCard(int $id) : void
Parameters
- $id : int
-
Library card ID
Tags
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
Return values
mixed —The output of the save method.
checkEmailVerified()
Check whether the email address has been verified yet.
public
checkEmailVerified() : bool
Tags
Return values
bool —clearCredentials()
Reset ILS login credentials.
public
clearCredentials() : void
Tags
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
Return values
int —The number of rows deleted.
deleteLibraryCard()
Delete library card
public
deleteLibraryCard(int $id) : void
Parameters
- $id : int
-
Library card ID
Tags
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
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
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
Return values
T —getDbServiceManager()
Get the service plugin manager. Throw an exception if it is missing.
public
getDbServiceManager() : PluginManager
Tags
Return values
PluginManager —getDbTable()
Get a database table object.
public
getDbTable(string $table) : Gateway
Parameters
- $table : string
-
Table to load.
Return values
Gateway —getDbTableManager()
Get the table plugin manager. Throw an exception if it is missing.
public
getDbTableManager() : PluginManager
Tags
Return values
PluginManager —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
Return values
UserCard|false —Card data if found, false otherwise
getLibraryCards()
Get all library cards associated with the user.
public
getLibraryCards() : AbstractResultSet
Tags
Return values
AbstractResultSet —getLists()
Get all of the lists associated with this user.
public
getLists() : AbstractResultSet
Tags
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
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
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
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
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
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
Return values
void —saveCatalogId()
Save ILS ID.
public
saveCatalogId(string $catId) : mixed
Parameters
- $catId : string
-
Catalog ID to save.
Tags
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
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
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
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
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 —setCatId()
Catalog id setter
public
setCatId(string|null $catId) : UserEntityInterface
Parameters
- $catId : string|null
-
Catalog id
Return values
UserEntityInterface —setCatPassEnc()
Encrypted catalog password setter
public
setCatPassEnc(string|null $passEnc) : UserEntityInterface
Parameters
- $passEnc : string|null
-
Encrypted password
Return values
UserEntityInterface —setCatUsername()
Catalog username setter
public
setCatUsername(string|null $catUsername) : UserEntityInterface
Parameters
- $catUsername : string|null
-
Catalog username
Return values
UserEntityInterface —setCollege()
Set college.
public
setCollege(string $college) : UserEntityInterface
Parameters
- $college : string
-
College
Return values
UserEntityInterface —setConfig()
Configuration setter
public
setConfig(Config $config) : void
Parameters
- $config : Config
-
VuFind configuration
Tags
Return values
void —setCreated()
Created setter
public
setCreated(DateTime $dateTime) : UserEntityInterface
Parameters
- $dateTime : DateTime
-
Creation date
Return values
UserEntityInterface —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
Return values
void —setDbServiceManager()
Set the service plugin manager.
public
setDbServiceManager(PluginManager $manager) : void
Parameters
- $manager : PluginManager
-
Plugin manager
Return values
void —setDbTableManager()
Set the table plugin manager.
public
setDbTableManager(PluginManager $manager) : void
Parameters
- $manager : PluginManager
-
Plugin manager
Return values
void —setEmail()
Set email.
public
setEmail(string $email) : UserEntityInterface
Parameters
- $email : string
-
Email address
Return values
UserEntityInterface —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 —setFirstname()
Set firstname.
public
setFirstname(string $firstName) : UserEntityInterface
Parameters
- $firstName : string
-
New first name
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 —setHomeLibrary()
Home library setter
public
setHomeLibrary(string|null $homeLibrary) : UserEntityInterface
Parameters
- $homeLibrary : string|null
-
Home library
Return values
UserEntityInterface —setLastLanguage()
Set last language.
public
setLastLanguage(string $lang) : UserEntityInterface
Parameters
- $lang : string
-
Last language
Return values
UserEntityInterface —setLastLogin()
Last login setter.
public
setLastLogin(DateTime $dateTime) : UserEntityInterface
Parameters
- $dateTime : DateTime
-
Last login date
Return values
UserEntityInterface —setLastname()
Set lastname.
public
setLastname(string $lastName) : UserEntityInterface
Parameters
- $lastName : string
-
New last name
Return values
UserEntityInterface —setMajor()
Set major.
public
setMajor(string $major) : UserEntityInterface
Parameters
- $major : string
-
Major
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 —setPendingEmail()
Set pending email.
public
setPendingEmail(string $email) : UserEntityInterface
Parameters
- $email : string
-
New pending email
Return values
UserEntityInterface —setRawCatPassword()
Raw catalog password setter
public
setRawCatPassword(string|null $catPassword) : UserEntityInterface
Parameters
- $catPassword : string|null
-
Cat password
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 —setUsername()
Username setter
public
setUsername(string $username) : UserEntityInterface
Parameters
- $username : string
-
Username
Return values
UserEntityInterface —setVerifyHash()
Set verification hash for recovery.
public
setVerifyHash(string $hash) : UserEntityInterface
Parameters
- $hash : string
-
Hash value to save
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
Return values
void —updateHash()
Update the verification hash for this user
public
updateHash() : bool
Tags
Return values
bool —save success
updateLastLanguage()
Updated saved language
public
updateLastLanguage(string $language) : void
Parameters
- $language : string
-
New language
Tags
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
Return values
string|bool —The encrypted/decrypted string
getUserCardService()
Get a UserCard service object.
protected
getUserCardService() : UserCardServiceInterface
Return values
UserCardServiceInterface —passwordEncryptionEnabled()
Is ILS password encryption enabled?
protected
passwordEncryptionEnabled() : bool
Tags
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