UserCardService
extends AbstractDbService
in package
implements
DbServiceAwareInterface, DbTableAwareInterface, UserCardServiceInterface
Uses
DbServiceAwareTrait, DbTableAwareTrait
Database service for UserCard.
Tags
Interfaces, Classes, Traits and Enums
- 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
- UserCardServiceInterface
- Database service for UserCard.
Table of Contents
- $capabilities : AccountCapabilities
- $dbServiceManager : PluginManager
- Database service plugin manager
- $ilsAuthenticator : ILSAuthenticator
- $tableManager : PluginManager
- Database table plugin manager
- __construct() : mixed
- Constructor
- activateLibraryCard() : void
- Activate a library card for the given username.
- createEntity() : UserCardEntityInterface
- Create a UserCard entity object.
- deleteLibraryCard() : bool
- Delete library card.
- getAllRowsWithUsernames() : array<string|int, UserCardEntityInterface>
- Get user_card rows with catalog usernames set.
- 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.
- getInsecureRows() : array<string|int, UserCardEntityInterface>
- Get user_card rows with insecure catalog passwords.
- getLibraryCards() : array<string|int, UserCardEntityInterface>
- Get all library cards associated with the user.
- getOrCreateLibraryCard() : UserCardEntityInterface
- Get or create library card data.
- persistEntity() : void
- Persist an entity.
- persistLibraryCardData() : UserCardEntityInterface
- Persist the provided library card data, either by updating a specified card or by creating a new one (when $card is null). Also updates the primary user row when appropriate. Will throw an exception if a duplicate $username value is provided; there should only be one card row per username.
- setDbServiceManager() : void
- Set the service plugin manager.
- setDbTableManager() : void
- Set the table plugin manager.
- synchronizeUserLibraryCardData() : bool
- Verify that the user's current ILS settings exist in their library card data (if enabled) and are up to date. Designed to be called after updating the user row; will create or modify library card rows as needed.
Properties
$capabilities
protected
AccountCapabilities
$capabilities
$dbServiceManager
Database service plugin manager
protected
PluginManager
$dbServiceManager
$ilsAuthenticator
protected
ILSAuthenticator
$ilsAuthenticator
$tableManager
Database table plugin manager
protected
PluginManager
$tableManager
Methods
__construct()
Constructor
public
__construct(ILSAuthenticator $ilsAuthenticator, AccountCapabilities $capabilities) : mixed
Parameters
- $ilsAuthenticator : ILSAuthenticator
-
ILS authenticator
- $capabilities : AccountCapabilities
-
Account capabilities configuration
Return values
mixed —activateLibraryCard()
Activate a library card for the given username.
public
activateLibraryCard(UserEntityInterface|int $userOrId, int $id) : void
Parameters
- $userOrId : UserEntityInterface|int
-
User owning card
- $id : int
-
Library card ID to activate
Tags
Return values
void —createEntity()
Create a UserCard entity object.
public
createEntity() : UserCardEntityInterface
Return values
UserCardEntityInterface —deleteLibraryCard()
Delete library card.
public
deleteLibraryCard(UserEntityInterface $user, UserCardEntityInterface|int $userCard) : bool
Parameters
- $user : UserEntityInterface
-
User owning card to delete
- $userCard : UserCardEntityInterface|int
-
UserCard id or object to be deleted
Tags
Return values
bool —getAllRowsWithUsernames()
Get user_card rows with catalog usernames set.
public
getAllRowsWithUsernames() : array<string|int, UserCardEntityInterface>
Return values
array<string|int, UserCardEntityInterface> —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 —getInsecureRows()
Get user_card rows with insecure catalog passwords.
public
getInsecureRows() : array<string|int, UserCardEntityInterface>
Return values
array<string|int, UserCardEntityInterface> —getLibraryCards()
Get all library cards associated with the user.
public
getLibraryCards(UserEntityInterface|int $userOrId[, int|null $id = null ][, string|null $catUsername = null ]) : array<string|int, UserCardEntityInterface>
Parameters
- $userOrId : UserEntityInterface|int
-
User object or identifier
- $id : int|null = null
-
Optional card ID filter
- $catUsername : string|null = null
-
Optional catalog username filter
Return values
array<string|int, UserCardEntityInterface> —getOrCreateLibraryCard()
Get or create library card data.
public
getOrCreateLibraryCard(UserEntityInterface|int $userOrId[, int|null $id = null ]) : UserCardEntityInterface
Parameters
- $userOrId : UserEntityInterface|int
-
User object or identifier
- $id : int|null = null
-
Card ID to fetch (or null to create a new card)
Tags
Return values
UserCardEntityInterface —Card data if found; throws exception otherwise
persistEntity()
Persist an entity.
public
persistEntity(EntityInterface $entity) : void
Parameters
- $entity : EntityInterface
-
Entity to persist.
Return values
void —persistLibraryCardData()
Persist the provided library card data, either by updating a specified card or by creating a new one (when $card is null). Also updates the primary user row when appropriate. Will throw an exception if a duplicate $username value is provided; there should only be one card row per username.
public
persistLibraryCardData(UserEntityInterface|int $userOrId, UserCardEntityInterface|int|null $cardOrId, string $cardName, string $username, string $password[, string $homeLib = '' ]) : UserCardEntityInterface
Returns the row that was added or updated.
Parameters
- $userOrId : UserEntityInterface|int
-
User object or identifier
- $cardOrId : UserCardEntityInterface|int|null
-
Card entity or ID (null = create new)
- $cardName : string
-
Card name
- $username : string
-
Username
- $password : string
-
Password
- $homeLib : string = ''
-
Home Library
Tags
Return values
UserCardEntityInterface —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 —synchronizeUserLibraryCardData()
Verify that the user's current ILS settings exist in their library card data (if enabled) and are up to date. Designed to be called after updating the user row; will create or modify library card rows as needed.
public
synchronizeUserLibraryCardData(UserEntityInterface|int $userOrId) : bool
Parameters
- $userOrId : UserEntityInterface|int
-
User object or identifier