Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 include_once('Auth/Container/LDAP.php');
00025
00036 class ilAuthContainerLDAP extends Auth_Container_LDAP
00037 {
00038 private $optional_check = false;
00039
00040 private $log = null;
00041 private $server = null;
00042
00050 public function __construct(ilLDAPServer $server,$a_params)
00051 {
00052 global $ilLog;
00053
00054 $this->server = $server;
00055 parent::__construct($a_params);
00056 $this->log = $ilLog;
00057 }
00058
00066 public function enableOptionalGroupCheck()
00067 {
00068 $this->optional_check = true;
00069 $this->updateUserFilter();
00070 }
00071
00078 public function enabledOptionalGroupCheck()
00079 {
00080 return (bool) $this->optional_check;
00081 }
00082
00083
00092 public function checkGroup($a_name)
00093 {
00094 $this->log->write(__METHOD__.': checking group restrictions...');
00095
00096
00097 $groups = $this->server->getGroupNames();
00098
00099 if(!count($groups))
00100 {
00101 $this->log->write(__METHOD__.': No group restrictions found.');
00102 return true;
00103 }
00104 elseif($this->server->isMembershipOptional() and !$this->optional_check)
00105 {
00106 $this->log->write(__METHOD__.': Group membership is optional.');
00107 return true;
00108 }
00109
00110 foreach($groups as $group)
00111 {
00112 $this->options['group'] = $group;
00113
00114 if(parent::checkGroup($a_name))
00115 {
00116 return true;
00117 }
00118 }
00119 return false;
00120 }
00130 public function _debug($a_message = '',$a_line = 0)
00131 {
00132 if(is_object($this->log))
00133 {
00134 $this->log->write('LDAP PEAR: '.$a_message);
00135 }
00136 parent::_debug($a_message,$a_line);
00137 }
00138
00145 private function updateUserFilter()
00146 {
00147 $this->options['userfilter'] = $this->server->getGroupUserFilter();
00148 }
00149
00150 }
00151
00152
00153
00154 ?>