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'.
저자: Olav Morken ([email protected])
상속: extends sspmod_consent_Store
파일 보기 프로젝트 열기: simplesamlphp/simplesamlphp

공개 메소드들

메소드 설명
__construct ( array $config ) Parse configuration.
__sleep ( ) : array Called before serialization.
deleteAllConsents ( string $userId ) : integer Delete all consents.
deleteConsent ( string $userId, string $destinationId ) : integer Delete consent.
getConsents ( string $userId ) : array Retrieve consents.
getStatistics ( ) : array Get statistics from the database
hasConsent ( string $userId, string $destinationId, string $attributeSet ) : boolean Check for consent.
saveConsent ( string $userId, string $destinationId, string $attributeSet ) : void | true Save consent.
selftest ( ) : boolean A quick selftest of the consent database.

비공개 메소드들

메소드 설명
_createTable ( ) : True Create consent table.
_execute ( string $statement, array $parameters ) : PDOStatement | false Prepare and execute statement.
_formatError ( array $error ) : string Format PDO error.
_getDB ( ) : PDO | false Get database handle.

메소드 상세

__construct() 공개 메소드

This constructor parses the configuration.
public __construct ( array $config )
$config array Configuration for database consent store.

__sleep() 공개 메소드

Called before serialization.
public __sleep ( ) : array
리턴 array The variables which should be serialized.

deleteAllConsents() 공개 메소드

Delete all consents.
public deleteAllConsents ( string $userId ) : integer
$userId string The hash identifying the user at an IdP.
리턴 integer Number of consents deleted

deleteConsent() 공개 메소드

Called when a user revokes consent for a given destination.
public deleteConsent ( string $userId, string $destinationId ) : integer
$userId string The hash identifying the user at an IdP.
$destinationId string A string which identifies the destination.
리턴 integer Number of consents deleted

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
public getStatistics ( ) : array
리턴 array Array containing the statistics

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.