/** * Constructor * * checks if the mysql interface is available, otherwise it will * set the variable $success of the basis class to false * * @author Matthias Grimm <*****@*****.**> */ function __construct() { global $conf; $this->cnf = $conf['auth']['mysql']; if (method_exists($this, 'auth_basic')) { parent::__construct(); } if (!function_exists('mysql_connect')) { if ($this->cnf['debug']) { msg("MySQL err: PHP MySQL extension not found.", -1, __LINE__, __FILE__); } $this->success = false; return; } // default to UTF-8, you rarely want something else if (!isset($this->cnf['charset'])) { $this->cnf['charset'] = 'utf8'; } $this->defaultgroup = $conf['defaultgroup']; // set capabilities based upon config strings set if (empty($this->cnf['server']) || empty($this->cnf['user']) || !isset($this->cnf['password']) || empty($this->cnf['database'])) { if ($this->cnf['debug']) { msg("MySQL err: insufficient configuration.", -1, __LINE__, __FILE__); } $this->success = false; return; } $this->cando['addUser'] = $this->_chkcnf(array('getUserInfo', 'getGroups', 'addUser', 'getUserID', 'getGroupID', 'addGroup', 'addUserGroup'), true); $this->cando['delUser'] = $this->_chkcnf(array('getUserID', 'delUser', 'delUserRefs'), true); $this->cando['modLogin'] = $this->_chkcnf(array('getUserID', 'updateUser', 'UpdateTarget'), true); $this->cando['modPass'] = $this->cando['modLogin']; $this->cando['modName'] = $this->cando['modLogin']; $this->cando['modMail'] = $this->cando['modLogin']; $this->cando['modGroups'] = $this->_chkcnf(array('getUserID', 'getGroups', 'getGroupID', 'addGroup', 'addUserGroup', 'delGroup', 'getGroupID', 'delUserGroup'), true); /* getGroups is not yet supported $this->cando['getGroups'] = $this->_chkcnf(array('getGroups', 'getGroupID'),false); */ $this->cando['getUsers'] = $this->_chkcnf(array('getUsers', 'getUserInfo', 'getGroups'), false); $this->cando['getUserCount'] = $this->_chkcnf(array('getUsers'), false); }