PHP Class auth_plugin_authpdo, dokuwiki

Inheritance: extends DokuWiki_Auth_Plugin
ファイルを表示 Open project: splitbrain/dokuwiki

Protected Properties

Property Type Description
$groupcache The list of all groups
$pdo PDO

Public Methods

Method Description
__construct ( ) Constructor.
addGroup ( string $group ) : boolean Create a new group with the given name
checkPass ( string $user, string $pass ) : boolean Check user+password
createUser ( string $user, string $clear, string $name, string $mail, null | array $grps = null ) : boolean | null Create a new User [implement only where required/possible]
deleteUsers ( array $users ) : integer Delete one or more users
getUserCount ( array $filter = [] ) : integer Return a count of the number of user which meet $filter criteria
getUserData ( string $user, boolean $requireGroups = true ) : array | boolean Return user info
modifyUser ( string $user, array $changes ) : boolean Modify user data
retrieveGroups ( integer $start, integer $limit ) : array Retrieve groups
retrieveUsers ( integer $start, integer $limit, array $filter = null ) : array Bulk retrieval of user data [implement only where required/possible]

Protected Methods

Method Description
_chkcnf ( string[] $keys ) : boolean Check if the given config strings are set
_clearGroupCache ( ) Remove all entries from the group cache
_debug ( string | Exception $message, integer $err, integer $line ) Wrapper around msg() but outputs only when debug is enabled
_debugSQL ( string $sql, array $params, boolean $htmlescape = true ) : string create an approximation of the SQL string with parameters replaced
_deleteUser ( string $user ) : boolean Delete a user after removing all their group memberships
_joinGroup ( array $userdata, array $groupdata ) : boolean Adds the user to the group
_leaveGroup ( array $userdata, array $groupdata ) : boolean Removes the user from the group
_query ( string $sql, array $arguments = [] ) : array | integer | boolean Executes a query
_selectGroups ( ) : array | boolean Select all available groups
_selectUser ( string $user ) : boolean | array Select data of a specified user
_selectUserGroups ( array $userdata ) : array | boolean Select all groups of a user

Method Details

__construct() public method

Constructor.
public __construct ( )

_chkcnf() protected method

Check if the given config strings are set
Author: Matthias Grimm ([email protected])
protected _chkcnf ( string[] $keys ) : boolean
$keys string[]
return boolean

_clearGroupCache() protected method

Remove all entries from the group cache
protected _clearGroupCache ( )

_debug() protected method

Wrapper around msg() but outputs only when debug is enabled
protected _debug ( string | Exception $message, integer $err, integer $line )
$message string | Exception
$err integer
$line integer

_debugSQL() protected method

create an approximation of the SQL string with parameters replaced
protected _debugSQL ( string $sql, array $params, boolean $htmlescape = true ) : string
$sql string
$params array
$htmlescape boolean Should the result be escaped for output in HTML?
return string

_deleteUser() protected method

Delete a user after removing all their group memberships
protected _deleteUser ( string $user ) : boolean
$user string
return boolean true when the user was deleted

_joinGroup() protected method

Adds the user to the group
protected _joinGroup ( array $userdata, array $groupdata ) : boolean
$userdata array all the user data
$groupdata array all the group data
return boolean

_leaveGroup() protected method

Removes the user from the group
protected _leaveGroup ( array $userdata, array $groupdata ) : boolean
$userdata array all the user data
$groupdata array all the group data
return boolean

_query() protected method

Executes a query
protected _query ( string $sql, array $arguments = [] ) : array | integer | boolean
$sql string The SQL statement to execute
$arguments array Named parameters to be used in the statement
return array | integer | boolean The result as associative array for SELECTs, affected rows for others, false on error

_selectGroups() protected method

Select all available groups
protected _selectGroups ( ) : array | boolean
return array | boolean list of all available groups and their properties

_selectUser() protected method

Select data of a specified user
protected _selectUser ( string $user ) : boolean | array
$user string the user name
return boolean | array user data, false on error

_selectUserGroups() protected method

Select all groups of a user
protected _selectUserGroups ( array $userdata ) : array | boolean
$userdata array The userdata as returned by _selectUser()
return array | boolean list of group names, false on error

addGroup() public method

Create a new group with the given name
public addGroup ( string $group ) : boolean
$group string
return boolean

checkPass() public method

Check user+password
public checkPass ( string $user, string $pass ) : boolean
$user string the user name
$pass string the clear text password
return boolean

createUser() public method

Returns false if the user already exists, null when an error occurred and true if everything went well. The new user HAS TO be added to the default group by this function! Set addUser capability when implemented
public createUser ( string $user, string $clear, string $name, string $mail, null | array $grps = null ) : boolean | null
$user string
$clear string
$name string
$mail string
$grps null | array
return boolean | null

deleteUsers() public method

Set delUser capability when implemented
public deleteUsers ( array $users ) : integer
$users array
return integer number of users deleted

getUserCount() public method

Return a count of the number of user which meet $filter criteria
public getUserCount ( array $filter = [] ) : integer
$filter array array of field/pattern pairs, empty array for no filter
return integer

getUserData() public method

Returns info about the given user needs to contain at least these fields: name string full name of the user mail string email addres of the user grps array list of groups the user is in
public getUserData ( string $user, boolean $requireGroups = true ) : array | boolean
$user string the user name
$requireGroups boolean whether or not the returned data must include groups
return array | boolean containing user data or false

modifyUser() public method

Modify user data
public modifyUser ( string $user, array $changes ) : boolean
$user string nick of the user to be changed
$changes array array of field/value pairs to be changed (password will be clear text)
return boolean

retrieveGroups() public method

Set getGroups capability when implemented
public retrieveGroups ( integer $start, integer $limit ) : array
$start integer
$limit integer
return array

retrieveUsers() public method

Set getUsers capability when implemented
public retrieveUsers ( integer $start, integer $limit, array $filter = null ) : array
$start integer index of first user to be returned
$limit integer max number of users to be returned
$filter array array of field/pattern pairs, null for no filter
return array list of userinfo (refer getUserData for internal userinfo details)

Property Details

$groupcache protected_oe property

The list of all groups
protected $groupcache

$pdo protected_oe property

protected PDO $pdo
return PDO