• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/LDAP/classes/class.ilAuthContainerLDAP.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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                 // if there are multiple groups define check all of them for membership
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 ?>

Generated on Fri Dec 13 2013 17:56:57 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1