20 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
41 function &getInstance(&$auth_instance)
43 static $provis_instance;
44 if (!isset($provis_instance)) {
45 $provis_instance =
new XoopsAuthProvisionning($auth_instance);
47 return $provis_instance;
53 function XoopsAuthProvisionning(&$auth_instance)
55 $this->_auth_instance =& $auth_instance;
58 foreach (
$config as $key => $val) {
62 $this->default_TZ = $config_gen[
'default_TZ'];
63 $this->theme_set = $config_gen[
'theme_set'];
64 $this->com_mode = $config_gen[
'com_mode'];
65 $this->com_order = $config_gen[
'com_order'];
90 function sync($datas,
$uname, $pwd = null)
94 if ($this->ldap_provisionning) {
100 if ($this->ldap_provisionning && $this->ldap_provisionning_upd) {
112 function add($datas,
$uname, $pwd = null)
118 $newuser->setVar(
'uname',
$uname);
119 $newuser->setVar(
'pass', md5(stripslashes($pwd)));
120 $newuser->setVar(
'rank', 0);
121 $newuser->setVar(
'level', 1);
122 $newuser->setVar(
'timezone_offset', $this->default_TZ);
123 $newuser->setVar(
'theme', $this->theme_set);
124 $newuser->setVar(
'umode', $this->com_mode);
125 $newuser->setVar(
'uorder', $this->com_order);
126 $tab_mapping = explode(
'|', $this->ldap_field_mapping);
127 foreach ($tab_mapping as $mapping) {
128 $fields = explode(
'=', trim($mapping));
130 $newuser->setVar(trim(
$fields[0]), utf8_decode($datas[trim(
$fields[1])][0]));
133 foreach($this->ldap_provisionning_group as $groupid) {
136 $newuser->unsetNew();
139 redirect_header(XOOPS_URL .
'/user.php', 5, $newuser->getHtmlErrors());
153 $xoopsUser->setVar(
'pass', md5(stripslashes($pwd)));
154 $tab_mapping = explode(
'|', $this->ldap_field_mapping);
155 foreach ($tab_mapping as $mapping) {
156 $fields = explode(
'=', trim($mapping));