/**
  * 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 auth_mysql()
 {
     global $conf;
     $this->cnf = $conf['auth']['reu'];
     if (method_exists($this, 'auth_basic')) {
         parent::auth_basic();
     }
     if (!function_exists('mysql_connect')) {
         $this->msg_debug("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']) || empty($this->cnf['password']) || empty($this->cnf['database'])) {
         $this->msg_debug("MySQL err: insufficient configuration.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     // $this->cando['addUser']	  = 1;
     // $this->cando['delUser']	  = 1;
     // $this->cando['modLogin']	 = 1;
     // $this->cando['modPass']	  = 1;
     // $this->cando['modName']	  = 1;
     // $this->cando['modMail']	  = 1;
     // $this->cando['modGroups']	= 1;
     // $this->cando['getGroups']	= 1;
     // $this->cando['getUsers']	 = 1;
     // $this->cando['getUserCount'] = 1;
 }
Example #2
0
 /**
  * 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 auth_mysql()
 {
     global $conf;
     $this->cnf = $conf['auth']['mysql'];
     if (method_exists($this, 'auth_basic')) {
         parent::auth_basic();
     }
     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']) || empty($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);
 }
 function auth_uc()
 {
     global $conf;
     $this->cnf = $conf['auth']['uc'];
     if (method_exists($this, 'auth_basic')) {
         parent::auth_basic();
     }
     if (!function_exists('uc_authcode')) {
         if ($this->cnf['debug']) {
             msg('Cannot find UC client API.', -1, __LINE__, __FILE__);
         }
         $this->success = false;
         return;
     }
     if (!isset($this->cnf['charset'])) {
         $this->cnf['charset'] = 'utf8';
     }
     if (!isset($this->cnf['sync'])) {
         $this->cnf['sync'] = true;
     }
     if (!isset($this->cnf['cookie'])) {
         $this->cnf['cookie'] = 'dokuwiki_uc_auth';
     }
     // must forward clear pass.
     $this->cnf['forwardClearPass'] = 1;
     // TODO check uc config
     if (0) {
         if ($this->cnf['debug']) {
             msg('UC auth config error.', -1, __LINE__, __FILE__);
         }
         $this->success = false;
         return;
     }
     // check user group setting
     switch ($this->cnf['group_type']) {
         case 'discuz':
             $db_conf = $this->_get_dz_config();
             $this->_init_db($db_conf);
             break;
     }
     /*
     $cando = array (
         'addUser'     => false, // can Users be created?
         'delUser'     => false, // can Users be deleted?
         'modLogin'    => false, // can login names be changed?
         'modPass'     => false, // can passwords be changed?
         'modName'     => false, // can real names be changed?
         'modMail'     => false, // can emails be changed?
         'modGroups'   => false, // can groups be changed?
         'getUsers'    => false, // can a (filtered) list of users be retrieved?
         'getUserCount'=> false, // can the number of users be retrieved?
         'getGroups'   => false, // can a list of available groups be retrieved?
         'external'    => false, // does the module do external auth checking?
         'logoff'      => false, // has the module some special logoff method?
     );
     */
     $this->cando['addUser'] = true;
     $this->cando['delUser'] = true;
     $this->cando['modLogin'] = false;
     $this->cando['modPass'] = false;
     $this->cando['modName'] = true;
     $this->cando['modMail'] = true;
     // if you use discuz type to get user group, then you must change user group in discuz.
     $this->cando['modGroups'] = $this->cnf['group_type'] == 'discuz' ? false : true;
     $this->cando['getUsers'] = true;
     $this->cando['getUserCount'] = false;
     $this->cando['getGroups'] = true;
     $this->cando['external'] = $this->cnf['sync'];
     $this->cando['logoff'] = true;
 }