PHP Класс sspmod_consent_Consent_Store_Database, simplesamlphp
This class implements a consent store which stores the consent information
in a database. It is tested, and should work against MySQL, PostgreSQL and
SQLite.
It has the following options:
- dsn: The DSN which should be used to connect to the database server. See
PHP Manual for supported drivers and DSN formats.
- username: The username used for database connection.
- password: The password used for database connection.
- table: The name of the table used. Optional, defaults to 'consent'.
Показать файл
Открыть проект
Открытые методы
Приватные методы
Описание методов
__construct()
публичный Метод
This constructor parses the configuration.
__sleep()
публичный Метод
Called before serialization.
deleteAllConsents()
публичный Метод
deleteConsent()
публичный Метод
Called when a user revokes consent for a given destination.
getConsents()
публичный Метод
This function should return a list of consents the user has saved.
public getConsents ( string $userId ) : array |
$userId |
string |
The hash identifying the user at an IdP. |
Результат |
array |
Array of all destination ids the user has given consent for. |
getStatistics()
публичный Метод
The returned array contains 3 entries
- total: The total number of consents
- users: Total number of uses that have given consent
' services: Total number of services that has been given consent to
hasConsent()
публичный Метод
This function checks whether a given user has authorized the release of
the attributes identified by $attributeSet from $source to $destination.
public hasConsent ( string $userId, string $destinationId, string $attributeSet ) : boolean |
$userId |
string |
The hash identifying the user at an IdP. |
$destinationId |
string |
A string which identifies the destination. |
$attributeSet |
string |
A hash which identifies the attributes. |
Результат |
boolean |
True if the user has given consent earlier, false if not
(or on error). |
saveConsent()
публичный Метод
Called when the user asks for the consent to be saved. If consent information
for the given user and destination already exists, it should be overwritten.
public saveConsent ( string $userId, string $destinationId, string $attributeSet ) : void | true |
$userId |
string |
The hash identifying the user at an IdP. |
$destinationId |
string |
A string which identifies the destination. |
$attributeSet |
string |
A hash which identifies the attributes. |
Результат |
void | true |
True if consent is deleted. |
selftest()
публичный Метод
A quick selftest of the consent database.
public selftest ( ) : boolean |
Результат |
boolean |
True if OK, false if not. Will throw an exception on connection errors. |