ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLDAPServer.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 define('IL_LDAP_BIND_ANONYMOUS',0);
6 define('IL_LDAP_BIND_USER',1);
7 
8 define('IL_LDAP_SCOPE_SUB',0);
9 define('IL_LDAP_SCOPE_ONE',1);
10 define('IL_LDAP_SCOPE_BASE',2);
11 
25 {
26  private static $instances = array();
27 
28  const DEBUG = false;
29  const DEFAULT_VERSION = 3;
31 
32  private $role_bind_dn = '';
33  private $role_bind_pass = '';
34  private $role_sync_active = 0;
35 
36  private $server_id = null;
37  private $fallback_urls = array();
38 
39  private $enabled_authentication = true;
41 
42  public function __construct($a_server_id = 0)
43  {
44  global $ilDB,$lng;
45 
46  $this->db = $ilDB;
47  $this->lng = $lng;
48  $this->server_id = $a_server_id;
49 
50  $this->read();
51  }
52 
53  public static function getInstanceByServerId($a_server_id)
54  {
55  if(isset(self::$instances[$a_server_id]))
56  {
57  return self::$instances[$a_server_id];
58  }
59  return self::$instances[$a_server_id] = new ilLDAPServer($a_server_id);
60  }
61 
66  public function rotateFallbacks()
67  {
68  global $ilDB;
69 
70  if(!$this->fallback_urls)
71  {
72  return FALSE;
73  }
74 
75  $all_urls = array_merge($this->fallback_urls);
76  $all_urls[] = $this->getUrl();
77 
78  $query = 'UPDATE ldap_server_settings SET '.
79  'url = '.$ilDB->quote(implode(',', $all_urls),'text').' '.
80  'WHERE server_id = '.$ilDB->quote($this->getServerId(),'integer');
81  $ilDB->manipulate($query);
82  return TRUE;
83  }
84 
85 
90  public static function checkLDAPLib()
91  {
92  return function_exists('ldap_bind');
93  }
94 
100  public static function _getActiveServerList()
101  {
102  global $ilDB;
103 
104  $query = "SELECT server_id FROM ldap_server_settings ".
105  "WHERE active = 1 AND authentication = 1 ".
106  "ORDER BY name ";
107  $res = $ilDB->query($query);
108  $server_ids = array();
109  while($row = $ilDB->fetchObject($res))
110  {
111  $server_ids[] = $row->server_id;
112  }
113  return $server_ids;
114  }
115 
121  public static function _getCronServerIds()
122  {
123  global $ilDB;
124 
125  $query = "SELECT server_id FROM ldap_server_settings ".
126  "WHERE active = 1 ".
127  "AND sync_per_cron = 1 ".
128  "ORDER BY name";
129 
130  $res = $ilDB->query($query);
131  while($row = $ilDB->fetchObject($res))
132  {
133  $server_ids[] = $row->server_id;
134  }
135  return $server_ids ? $server_ids : array();
136  }
137 
145  public static function _getRoleSyncServerIds()
146  {
147  global $ilDB;
148 
149  $query = "SELECT server_id FROM ldap_server_settings ".
150  "WHERE active = 1 ".
151  "AND role_sync_active = 1 ";
152 
153  $res = $ilDB->query($query);
154  $server_ids = array();
155  while($row = $ilDB->fetchObject($res))
156  {
157  $server_ids[] = $row->server_id;
158  }
159  return $server_ids;
160  }
161 
169  public static function _getPasswordServers()
170  {
172  }
173 
174 
180  public static function _getFirstActiveServer()
181  {
183  if(count($servers))
184  {
185  return $servers[0];
186  }
187  return 0;
188  }
189 
195  public static function _getServerList()
196  {
197  global $ilDB;
198 
199  $query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
200 
201  $res = $ilDB->query($query);
202  while($row = $ilDB->fetchObject($res))
203  {
204  $server_ids[] = $row->server_id;
205  }
206  return $server_ids ? $server_ids : array();
207  }
208 
209  /*
210  * Get first server id
211  *
212  * @return integer server_id
213  */
214  public static function _getFirstServer()
215  {
216  $servers = ilLDAPServer::_getServerList();
217 
218  if(count($servers))
219  {
220  return $servers[0];
221  }
222  return 0;
223  }
224 
225 
226  public static function getAvailableDataSources($a_auth_mode)
227  {
228  global $ilDB;
229 
230  $query = "SELECT server_id FROM ldap_server_settings ".
231  "WHERE active = ".$ilDB->quote(1,'integer')." ".
232  "AND authentication = ".$ilDB->quote(0,'integer')." ".
233  "AND ( authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
234  "OR authentication_type = ".$ilDB->quote(0,'integer').")";
235  $res = $ilDB->query($query);
236 
237  $server_ids = array();
238  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
239  {
240  $server_ids[] = $row->server_id;
241  }
242  return $server_ids;
243  }
244 
251  public static function isDataSourceActive($a_auth_mode)
252  {
253  global $ilDB;
254 
255  $query = "SELECT server_id FROM ldap_server_settings ".
256  "WHERE authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
257  "AND authentication = ".$ilDB->quote(0,'integer');
258  $res = $ilDB->query($query);
259  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
260  {
261  return true;
262  }
263  return false;
264  }
265 
266  public static function getDataSource($a_auth_mode)
267  {
268  global $ilDB;
269 
270  $query = "SELECT server_id FROM ldap_server_settings ".
271  "WHERE authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
272  "AND authentication = ".$ilDB->quote(0,'integer');
273  $res = $ilDB->query($query);
274  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
275  {
276  return $row->server_id;
277  }
278  return 0;
279  }
280 
287  public static function toggleDataSource($a_auth_mode,$a_status)
288  {
289  global $ilDB;
290 
291  if($a_status)
292  {
293  $query = "UPDATE ldap_server_settings ".
294  "SET authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
295  "WHERE authentication = ".$ilDB->quote(0,'integer');
296  $ilDB->query($query);
297  }
298  else
299  {
300  $query = "UPDATE ldap_server_settings ".
301  "SET authentication_type = ".$ilDB->quote(0,'integer')." ".
302  "WHERE authentication = ".$ilDB->quote(0,'integer');
303  $ilDB->query($query);
304  }
305  return true;
306  }
307 
308  // Set/Get
309  public function getServerId()
310  {
311  return $this->server_id;
312  }
313 
318  public function enableAuthentication($a_status)
319  {
320  $this->enabled_authentication = (bool) $a_status;
321  }
322 
327  public function isAuthenticationEnabled()
328  {
329  return (bool) $this->enabled_authentication;
330  }
331 
336  public function setAuthenticationMapping($a_map)
337  {
338  $this->authentication_mapping = $a_map;
339  }
340 
345  public function getAuthenticationMapping()
346  {
348  }
349 
355  public function getAuthenticationMappingKey()
356  {
357  if($this->isAuthenticationEnabled() or !$this->getAuthenticationMapping())
358  {
359  return 'ldap';
360  }
362  }
363 
364  public function toggleActive($a_status)
365  {
366  $this->active = $a_status;
367  }
368  public function isActive()
369  {
370  return $this->active;
371  }
372  public function getUrl()
373  {
374  return $this->url;
375  }
376  public function setUrl($a_url)
377  {
378  $this->url_string = $a_url;
379 
380  // Maybe there are more than one url's (comma seperated).
381  $urls = explode(',',$a_url);
382 
383  $counter = 0;
384  foreach($urls as $url)
385  {
386  $url = trim($url);
387  if(!$counter++)
388  {
389  $this->url = $url;
390  }
391  else
392  {
393  $this->fallback_urls[] = $url;
394  }
395  }
396  }
397  public function getUrlString()
398  {
399  return $this->url_string;
400  }
401 
409  public function doConnectionCheck()
410  {
411  global $ilLog;
412 
413  include_once('Services/LDAP/classes/class.ilLDAPQuery.php');
414 
415  foreach(array_merge(array(0 => $this->url),$this->fallback_urls) as $url)
416  {
417  try
418  {
419  // Need to do a full bind, since openldap return valid connection links for invalid hosts
420  $query = new ilLDAPQuery($this,$url);
421  $query->bind(IL_LDAP_BIND_TEST);
422  $this->url = $url;
423  $ilLog->write(__METHOD__.': Using url: '.$url.'.');
424  return TRUE;
425  }
426  catch(ilLDAPQueryException $exc)
427  {
428  $this->rotateFallbacks();
429  $ilLog->write(__METHOD__.': Cannot connect to LDAP server: '.$url.' '. $exc->getCode().': '.$exc->getMessage());
430  }
431  }
432  $ilLog->write(__METHOD__.': No valid LDAP server found.');
433  return FALSE;
434  }
435 
436 
437  public function getName()
438  {
439  return $this->name;
440  }
441  public function setName($a_name)
442  {
443  $this->name = $a_name;
444  }
445  public function getVersion()
446  {
447  return $this->version ? $this->version : self::DEFAULT_VERSION;
448  }
449  public function setVersion($a_version)
450  {
451  $this->version = $a_version;
452  }
453  public function getBaseDN()
454  {
455  return $this->base_dn;
456  }
457  public function setBaseDN($a_base_dn)
458  {
459  $this->base_dn = $a_base_dn;
460  }
461  public function isActiveReferrer()
462  {
463  return $this->referrals ? true : false;
464  }
465  public function toggleReferrer($a_status)
466  {
467  $this->referrals = $a_status;
468  }
469  public function isActiveTLS()
470  {
471  return $this->tls ? true : false;
472  }
473  public function toggleTLS($a_status)
474  {
475  $this->tls = $a_status;
476  }
477  public function getBindingType()
478  {
479  return $this->binding_type;
480  }
481  public function setBindingType($a_type)
482  {
483  if($a_type == IL_LDAP_BIND_USER)
484  {
485  $this->binding_type = IL_LDAP_BIND_USER;
486  }
487  else
488  {
489  $this->binding_type = IL_LDAP_BIND_ANONYMOUS;
490  }
491  }
492  public function getBindUser()
493  {
494  return $this->bind_user;
495  }
496  public function setBindUser($a_user)
497  {
498  $this->bind_user = $a_user;
499  }
500  public function getBindPassword()
501  {
502  return $this->bind_password;
503  }
504  public function setBindPassword($a_password)
505  {
506  $this->bind_password = $a_password;
507  }
508  public function getSearchBase()
509  {
510  return $this->search_base;
511  }
512  public function setSearchBase($a_search_base)
513  {
514  $this->search_base = $a_search_base;
515  }
516  public function getUserAttribute()
517  {
518  return $this->user_attribute;
519  }
520  public function setUserAttribute($a_user_attr)
521  {
522  $this->user_attribute = $a_user_attr;
523  }
524  public function getFilter()
525  {
526  return $this->prepareFilter($this->filter);
527  }
528  public function setFilter($a_filter)
529  {
530  $this->filter = $a_filter;
531  }
532  public function getGroupDN()
533  {
534  return $this->group_dn;
535  }
536  public function setGroupDN($a_value)
537  {
538  $this->group_dn = $a_value;
539  }
540  public function getGroupFilter()
541  {
542  return $this->prepareFilter($this->group_filter);
543  }
544  public function setGroupFilter($a_value)
545  {
546  $this->group_filter = $a_value;
547  }
548  public function getGroupMember()
549  {
550  return $this->group_member;
551  }
552  public function setGroupMember($a_value)
553  {
554  $this->group_member = $a_value;
555  }
556  public function getGroupName()
557  {
558  return $this->group_name;
559  }
560  public function setGroupName($a_value)
561  {
562  $this->group_name = $a_value;
563  }
571  public function getGroupNames()
572  {
573  $names = explode(',',$this->getGroupName());
574 
575  if(!is_array($names))
576  {
577  return array();
578  }
579  foreach($names as $name)
580  {
581  $new_names[] = trim($name);
582  }
583  return $new_names;
584  }
585 
586 
587  public function getGroupAttribute()
588  {
589  return $this->group_attribute;
590  }
591  public function setGroupAttribute($a_value)
592  {
593  $this->group_attribute = $a_value;
594  }
595 
596  public function toggleMembershipOptional($a_status)
597  {
598  $this->group_optional = (bool) $a_status;
599  }
600  public function isMembershipOptional()
601  {
602  return (bool) $this->group_optional;
603  }
604  public function setGroupUserFilter($a_filter)
605  {
606  $this->group_user_filter = $a_filter;
607  }
608  public function getGroupUserFilter()
609  {
610  return $this->group_user_filter;
611  }
612 
613  public function enabledGroupMemberIsDN()
614  {
615  return (bool) $this->memberisdn;
616  }
617  public function enableGroupMemberIsDN($a_value)
618  {
619  $this->memberisdn = (bool) $a_value;
620  }
621  public function setGroupScope($a_value)
622  {
623  $this->group_scope = $a_value;
624  }
625  public function getGroupScope()
626  {
627  return $this->group_scope;
628  }
629  public function setUserScope($a_value)
630  {
631  $this->user_scope = $a_value;
632  }
633  public function getUserScope()
634  {
635  return $this->user_scope;
636  }
637  public function enabledSyncOnLogin()
638  {
639  return $this->sync_on_login;
640  }
641  public function enableSyncOnLogin($a_value)
642  {
643  $this->sync_on_login = (int) $a_value;
644  }
645  public function enabledSyncPerCron()
646  {
647  return $this->sync_per_cron;
648  }
649  public function enableSyncPerCron($a_value)
650  {
651  $this->sync_per_cron = (int) $a_value;
652  }
653  public function setGlobalRole($a_role)
654  {
655  $this->global_role = $a_role;
656  }
657  public function getRoleBindDN()
658  {
659  return $this->role_bind_dn;
660  }
661  public function setRoleBindDN($a_value)
662  {
663  $this->role_bind_dn = $a_value;
664  }
665  public function getRoleBindPassword()
666  {
667  return $this->role_bind_pass;
668  }
669  public function setRoleBindPassword($a_value)
670  {
671  $this->role_bind_pass = $a_value;
672  }
673  public function enabledRoleSynchronization()
674  {
676  }
677  public function enableRoleSynchronization($a_value)
678  {
679  $this->role_sync_active = $a_value;
680  }
681 
689  public function enableAccountMigration($a_status)
690  {
691  $this->account_migration = $a_status;
692  }
693 
700  public function isAccountMigrationEnabled()
701  {
702  return $this->account_migration ? true : false;
703  }
704 
705 
711  public function validate()
712  {
713  global $ilErr;
714 
715  $ilErr->setMessage('');
716  if(!strlen($this->getName()) ||
717  !strlen($this->getUrl()) ||
718  !strlen($this->getBaseDN()) ||
719  !strlen($this->getUserAttribute()))
720  {
721  $ilErr->setMessage($this->lng->txt('fill_out_all_required_fields'));
722  }
723 
724  if($this->getBindingType() == IL_LDAP_BIND_USER
725  && (!strlen($this->getBindUser()) || !strlen($this->getBindPassword())))
726  {
727  $ilErr->appendMessage($this->lng->txt('ldap_missing_bind_user'));
728  }
729 
730  if(($this->enabledSyncPerCron() or $this->enabledSyncOnLogin()) and !$this->global_role)
731  {
732  $ilErr->appendMessage($this->lng->txt('ldap_missing_role_assignment'));
733  }
734  if($this->getVersion() == 2 and $this->isActiveTLS())
735  {
736  $ilErr->appendMessage($this->lng->txt('ldap_tls_conflict'));
737  }
738 
739  return strlen($ilErr->getMessage()) ? false : true;
740  }
741 
742  public function create()
743  {
744  global $ilDB;
745 
746  $next_id = $ilDB->nextId('ldap_server_settings');
747 
748  $query = 'INSERT INTO ldap_server_settings (server_id,active,name,url,version,base_dn,referrals,tls,bind_type,bind_user,bind_pass,'.
749  'search_base,user_scope,user_attribute,filter,group_dn,group_scope,group_filter,group_member,group_memberisdn,group_name,'.
750  'group_attribute,group_optional,group_user_filter,sync_on_login,sync_per_cron,role_sync_active,role_bind_dn,role_bind_pass,migration, '.
751  'authentication,authentication_type) '.
752  'VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)';
753  $res = $ilDB->queryF($query,
754  array(
755  'integer','integer','text','text','integer','text','integer','integer','integer','text','text','text','integer',
756  'text','text','text','integer','text','text','integer','text','text','integer','text','integer','integer','integer',
757  'text','text', 'integer','integer','integer'),
758  array(
759  $next_id,
760  $this->isActive(),
761  $this->getName(),
762  $this->getUrlString(),
763  $this->getVersion(),
764  $this->getBaseDN(),
765  $this->isActiveReferrer(),
766  $this->isActiveTLS(),
767  $this->getBindingType(),
768  $this->getBindUser(),
769  $this->getBindPassword(),
770  $this->getSearchBase(),
771  $this->getUserScope(),
772  $this->getUserAttribute(),
773  $this->getFilter(),
774  $this->getGroupDN(),
775  $this->getGroupScope(),
776  $this->getGroupFilter(),
777  $this->getGroupMember(),
778  $this->enabledGroupMemberIsDN(),
779  $this->getGroupName(),
780  $this->getGroupAttribute(),
781  $this->isMembershipOptional(),
782  $this->getGroupUserFilter(),
783  $this->enabledSyncOnLogin(),
784  $this->enabledSyncPerCron(),
786  $this->getRoleBindDN(),
787  $this->getRoleBindPassword(),
788  $this->isAccountMigrationEnabled(),
789  $this->isAuthenticationEnabled(),
790  $this->getAuthenticationMapping()
791  ));
792 
793  return $next_id;
794  }
795 
796  public function update()
797  {
798  global $ilDB;
799 
800  $query = "UPDATE ldap_server_settings SET ".
801  "active = ".$this->db->quote($this->isActive(),'integer').", ".
802  "name = ".$this->db->quote($this->getName(),'text').", ".
803  "url = ".$this->db->quote($this->getUrlString(),'text').", ".
804  "version = ".$this->db->quote($this->getVersion(),'integer').", ".
805  "base_dn = ".$this->db->quote($this->getBaseDN(),'text').", ".
806  "referrals = ".$this->db->quote($this->isActiveReferrer(),'integer').", ".
807  "tls = ".$this->db->quote($this->isActiveTLS(),'integer').", ".
808  "bind_type = ".$this->db->quote($this->getBindingType(),'integer').", ".
809  "bind_user = ".$this->db->quote($this->getBindUser(),'text').", ".
810  "bind_pass = ".$this->db->quote($this->getBindPassword(),'text').", ".
811  "search_base = ".$this->db->quote($this->getSearchBase(),'text').", ".
812  "user_scope = ".$this->db->quote($this->getUserScope(),'integer').", ".
813  "user_attribute = ".$this->db->quote($this->getUserAttribute(),'text').", ".
814  "filter = ".$this->db->quote($this->getFilter(),'text').", ".
815  "group_dn = ".$this->db->quote($this->getGroupDN(),'text').", ".
816  "group_scope = ".$this->db->quote($this->getGroupScope(),'integer').", ".
817  "group_filter = ".$this->db->quote($this->getGroupFilter(),'text').", ".
818  "group_member = ".$this->db->quote($this->getGroupMember(),'text').", ".
819  "group_memberisdn =".$this->db->quote((int) $this->enabledGroupMemberIsDN(),'integer').", ".
820  "group_name = ".$this->db->quote($this->getGroupName(),'text').", ".
821  "group_attribute = ".$this->db->quote($this->getGroupAttribute(),'text').", ".
822  "group_optional = ".$this->db->quote((int) $this->isMembershipOptional(),'integer').", ".
823  "group_user_filter = ".$this->db->quote($this->getGroupUserFilter(),'text').", ".
824  "sync_on_login = ".$this->db->quote(($this->enabledSyncOnLogin() ? 1 : 0),'integer').", ".
825  "sync_per_cron = ".$this->db->quote(($this->enabledSyncPerCron() ? 1 : 0),'integer').", ".
826  "role_sync_active = ".$this->db->quote($this->enabledRoleSynchronization(),'integer').", ".
827  "role_bind_dn = ".$this->db->quote($this->getRoleBindDN(),'text').", ".
828  "role_bind_pass = ".$this->db->quote($this->getRoleBindPassword(),'text').", ".
829  "migration = ".$this->db->quote((int)$this->isAccountMigrationEnabled(),'integer').", ".
830  'authentication = '.$this->db->quote((int) $this->isAuthenticationEnabled(),'integer').', '.
831  'authentication_type = '.$this->db->quote((int) $this->getAuthenticationMapping(),'integer').' '.
832  "WHERE server_id = ".$this->db->quote($this->getServerId(),'integer');
833 
834  $res = $ilDB->manipulate($query);
835  return true;
836  }
837 
843  public function toPearAuthArray()
844  {
845  $options = array(
846  'url' => $this->getUrl(),
847  'version' => (int) $this->getVersion(),
848  'referrals' => (bool) $this->isActiveReferrer());
849 
850  if($this->getBindingType() == IL_LDAP_BIND_USER)
851  {
852  $options['binddn'] = $this->getBindUser();
853  $options['bindpw'] = $this->getBindPassword();
854  }
855  $options['basedn'] = $this->getBaseDN();
856  $options['start_tls'] = (bool) $this->isActiveTLS();
857  $options['userdn'] = $this->getSearchBase();
858  switch($this->getUserScope())
859  {
860  case IL_LDAP_SCOPE_ONE:
861  $options['userscope'] = 'one';
862  break;
863  default:
864  $options['userscope'] = 'sub';
865  break;
866  }
867 
868  $options['userattr'] = $this->getUserAttribute();
869  $options['userfilter'] = $this->getFilter();
870  $options['attributes'] = $this->getPearAtributeArray();
871  $options['debug'] = self::DEBUG;
872 
873  if(@include_once('Log.php'))
874  {
875  if(@include_once('Log/observer.php'))
876  {
877  $options['enableLogging'] = true;
878  }
879  }
880  switch($this->getGroupScope())
881  {
882  case IL_LDAP_SCOPE_BASE:
883  $options['groupscope'] = 'base';
884  break;
885  case IL_LDAP_SCOPE_ONE:
886  $options['groupscope'] = 'one';
887  break;
888  default:
889  $options['groupscope'] = 'sub';
890  break;
891  }
892  $options['groupdn'] = $this->getGroupDN();
893  $options['groupattr'] = $this->getGroupAttribute();
894  $options['groupfilter'] = $this->getGroupFilter();
895  $options['memberattr'] = $this->getGroupMember();
896  $options['memberisdn'] = $this->enabledGroupMemberIsDN();
897  $options['group'] = $this->getGroupName();
898 
899 
900  return $options;
901  }
902 
910  private function prepareFilter($a_filter)
911  {
912  $filter = trim($a_filter);
913 
914  if(!strlen($filter))
915  {
916  return $filter;
917  }
918 
919  if(strpos($filter,'(') !== 0)
920  {
921  $filter = ('('.$filter);
922  }
923  if(substr($filter,-1) != ')')
924  {
925  $filter = ($filter.')');
926  }
927  return $filter;
928  }
929 
937  private function getPearAtributeArray()
938  {
939  if($this->enabledSyncOnLogin())
940  {
941  include_once('Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
942  include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php');
944  return array_merge(
945  array($this->getUserAttribute()),
946  $mapping->getFields(),
947  array('dn'),
949  );
950  }
951  else
952  {
953  return array($this->getUserAttribute());
954  }
955  }
956 
957 
958 
963  private function read()
964  {
965  if(!$this->server_id)
966  {
967  return true;
968  }
969  $query = "SELECT * FROM ldap_server_settings WHERE server_id = ".$this->db->quote($this->server_id)."";
970 
971  $res = $this->db->query($query);
972  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
973  {
974  $this->toggleActive($row->active);
975  $this->setName($row->name);
976  $this->setUrl($row->url);
977  $this->setVersion($row->version);
978  $this->setBaseDN($row->base_dn);
979  $this->toggleReferrer($row->referrals);
980  $this->toggleTLS($row->tls);
981  $this->setBindingType($row->bind_type);
982  $this->setBindUser($row->bind_user);
983  $this->setBindPassword($row->bind_pass);
984  $this->setSearchBase($row->search_base);
985  $this->setUserScope($row->user_scope);
986  $this->setUserAttribute($row->user_attribute);
987  $this->setFilter($row->filter);
988  $this->setGroupDN($row->group_dn);
989  $this->setGroupScope($row->group_scope);
990  $this->setGroupFilter($row->group_filter);
991  $this->setGroupMember($row->group_member);
992  $this->setGroupAttribute($row->group_attribute);
993  $this->toggleMembershipOptional($row->group_optional);
994  $this->setGroupUserFilter($row->group_user_filter);
995  $this->enableGroupMemberIsDN($row->group_memberisdn);
996  $this->setGroupName($row->group_name);
997  $this->enableSyncOnLogin($row->sync_on_login);
998  $this->enableSyncPerCron($row->sync_per_cron);
999  $this->enableRoleSynchronization($row->role_sync_active);
1000  $this->setRoleBindDN($row->role_bind_dn);
1001  $this->setRoleBindPassword($row->role_bind_pass);
1002  $this->enableAccountMigration($row->migration);
1003  $this->enableAuthentication($row->authentication);
1004  $this->setAuthenticationMapping($row->authentication_type);
1005  }
1006  }
1007 }
1008 ?>