ILIAS  release_4-4 Revision
ilAuthModeDetermination Class Reference
+ Collaboration diagram for ilAuthModeDetermination:

Public Member Functions

 isManualSelection ()
 is manual selection More...
 
 getKind ()
 get kind More...
 
 setKind ($a_kind)
 set kind of determination More...
 
 getAuthModeSequence ()
 get auth mode sequence More...
 
 getCountActiveAuthModes ()
 get number of auth modes More...
 
 setAuthModeSequence ($a_pos)
 set auth mode sequence More...
 
 save ()
 Save settings. More...
 

Static Public Member Functions

static _getInstance ()
 Get instance. More...
 

Data Fields

const TYPE_MANUAL = 0
 
const TYPE_AUTOMATIC = 1
 

Protected Attributes

 $db = null
 
 $settings = null
 
 $kind = 0
 
 $position = array()
 

Static Protected Attributes

static $instance = null
 

Private Member Functions

 __construct ()
 Constructor (Singleton) More...
 
 read ()
 Read settings. More...
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 34 of file class.ilAuthModeDetermination.php.

Constructor & Destructor Documentation

◆ __construct()

ilAuthModeDetermination::__construct ( )
private

Constructor (Singleton)

private

Definition at line 54 of file class.ilAuthModeDetermination.php.

References $ilSetting, and read().

55  {
56  global $ilSetting,$ilDB;
57 
58  $this->db = $ilDB;
59 
60  include_once "./Services/Administration/classes/class.ilSetting.php";
61  $this->settings = new ilSetting("auth_mode_determination");
62  $this->read();
63  }
ILIAS Setting Class.
global $ilSetting
Definition: privfeed.php:40
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

static ilAuthModeDetermination::_getInstance ( )
static

Get instance.

public

Definition at line 72 of file class.ilAuthModeDetermination.php.

Referenced by ilAuthUtils\_getAuthModeOfUser(), ilAuthContainerMultiple\fetchData(), ilAuthContainerApache\forceCreation(), ilObjAuthSettingsGUI\initAuthModeDetermination(), ilStartUpGUI\showLoginForm(), and ilObjAuthSettingsGUI\updateAuthModeDeterminationObject().

73  {
74  if(self::$instance)
75  {
76  return self::$instance;
77  }
78  return self::$instance = new ilAuthModeDetermination();
79  }
+ Here is the caller graph for this function:

◆ getAuthModeSequence()

ilAuthModeDetermination::getAuthModeSequence ( )

get auth mode sequence

public

Definition at line 123 of file class.ilAuthModeDetermination.php.

124  {
125  return $this->position ? $this->position : array();
126  }

◆ getCountActiveAuthModes()

ilAuthModeDetermination::getCountActiveAuthModes ( )

get number of auth modes

public

Definition at line 134 of file class.ilAuthModeDetermination.php.

135  {
136  return count($this->position);
137  }

◆ getKind()

ilAuthModeDetermination::getKind ( )

get kind

public

Definition at line 100 of file class.ilAuthModeDetermination.php.

References $kind.

Referenced by save().

+ Here is the caller graph for this function:

◆ isManualSelection()

ilAuthModeDetermination::isManualSelection ( )

is manual selection

public

Parameters

Definition at line 89 of file class.ilAuthModeDetermination.php.

90  {
91  return $this->kind == self::TYPE_MANUAL;
92  }

◆ read()

ilAuthModeDetermination::read ( )
private

Read settings.

private

Parameters

Definition at line 179 of file class.ilAuthModeDetermination.php.

References $ilSetting, ilLDAPServer\_getFirstActiveServer(), ilRadiusSettings\_getInstance(), AUTH_APACHE, AUTH_LDAP, AUTH_LOCAL, AUTH_RADIUS, AUTH_SOAP, and ilAuthUtils\getAuthPlugins().

Referenced by __construct().

180  {
181  global $ilSetting;
182 
183  $this->kind = $this->settings->get('kind',self::TYPE_MANUAL);
184 
185  include_once('Services/LDAP/classes/class.ilLDAPServer.php');
186  $ldap_active = ilLDAPServer::_getFirstActiveServer();
187 
188  include_once('Services/Radius/classes/class.ilRadiusSettings.php');
189  $rad_settings = ilRadiusSettings::_getInstance();
190  $rad_active = $rad_settings->isActive();
191 
192  $soap_active = $ilSetting->get('soap_auth_active',false);
193 
194  // apache settings
195  $apache_settings = new ilSetting('apache_auth');
196  $apache_active = $apache_settings->get('apache_enable_auth');
197 
198  // Check if active
199  for($i = 0; $i < 5; $i++)
200  {
201  if($auth_mode = $this->settings->get((string) $i,0))
202  {
203  switch($auth_mode)
204  {
205  case AUTH_LOCAL:
206  $this->position[] = $auth_mode;
207  break;
208 
209  case AUTH_LDAP:
210  if($ldap_active)
211  {
212  $this->position[] = $auth_mode;
213  }
214  break;
215 
216  case AUTH_RADIUS:
217  if($rad_active)
218  {
219  $this->position[] = $auth_mode;
220  }
221  break;
222 
223  case AUTH_SOAP:
224  if($soap_active)
225  {
226  $this->position[] = $auth_mode;
227  }
228  break;
229 
230  case AUTH_APACHE:
231  if($apache_active)
232  {
233  $this->position[] = $auth_mode;
234  }
235  break;
236 
237  // begin-patch auth_plugin
238  default:
239  foreach(ilAuthUtils::getAuthPlugins() as $pl)
240  {
241  if($pl->isAuthActive($auth_mode))
242  {
243  $this->position[] = $auth_mode;
244  }
245  }
246  break;
247  // end-patch auth_plugin
248 
249  }
250  }
251  }
252 
253  // Append missing active auth modes
254  if(!in_array(AUTH_LOCAL,$this->position))
255  {
256  $this->position[] = AUTH_LOCAL;
257  }
258  if($ldap_active)
259  {
260  if(!in_array(AUTH_LDAP,$this->position))
261  {
262  $this->position[] = AUTH_LDAP;
263  }
264  }
265  if($rad_active)
266  {
267  if(!in_array(AUTH_RADIUS,$this->position))
268  {
269  $this->position[] = AUTH_RADIUS;
270  }
271 
272  }
273  if($soap_active)
274  {
275  if(!in_array(AUTH_SOAP,$this->position))
276  {
277  $this->position[] = AUTH_SOAP;
278  }
279  }
280  if($apache_active)
281  {
282  if(!in_array(AUTH_APACHE,$this->position))
283  {
284  $this->position[] = AUTH_APACHE;
285  }
286  }
287  // begin-patch auth_plugin
288  foreach(ilAuthUtils::getAuthPlugins() as $pl)
289  {
290  foreach($pl->getAuthIds() as $auth_id)
291  {
292  if($pl->isAuthActive($auth_id))
293  {
294  if(!in_array($auth_id, $this->position))
295  {
296  $this->position[] = $auth_id;
297  }
298  }
299  }
300  }
301  // end-patch auth_plugin
302  }
static _getFirstActiveServer()
Get first active server.
ILIAS Setting Class.
const AUTH_LDAP
const AUTH_APACHE
static getAuthPlugins()
Get active enabled auth plugins.
static _getInstance()
singleton get instance
const AUTH_LOCAL
const AUTH_SOAP
global $ilSetting
Definition: privfeed.php:40
const AUTH_RADIUS
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilAuthModeDetermination::save ( )

Save settings.

public

Parameters

Definition at line 158 of file class.ilAuthModeDetermination.php.

References getKind().

159  {
160  $this->settings->deleteAll();
161 
162  $this->settings->set('kind',$this->getKind());
163 
164  $counter = 0;
165  foreach($this->position as $auth_mode)
166  {
167  $this->settings->set((string) $counter++,$auth_mode);
168  }
169  }
+ Here is the call graph for this function:

◆ setAuthModeSequence()

ilAuthModeDetermination::setAuthModeSequence (   $a_pos)

set auth mode sequence

public

Parameters
arrayposition => AUTH_MODE

Definition at line 146 of file class.ilAuthModeDetermination.php.

147  {
148  $this->position = $a_pos;
149  }

◆ setKind()

ilAuthModeDetermination::setKind (   $a_kind)

set kind of determination

public

Parameters
intTYPE_MANUAL or TYPE_DETERMINATION

Definition at line 112 of file class.ilAuthModeDetermination.php.

113  {
114  $this->kind = $a_kind;
115  }

Field Documentation

◆ $db

ilAuthModeDetermination::$db = null
protected

Definition at line 41 of file class.ilAuthModeDetermination.php.

◆ $instance

ilAuthModeDetermination::$instance = null
staticprotected

Definition at line 39 of file class.ilAuthModeDetermination.php.

◆ $kind

ilAuthModeDetermination::$kind = 0
protected

Definition at line 44 of file class.ilAuthModeDetermination.php.

Referenced by getKind().

◆ $position

ilAuthModeDetermination::$position = array()
protected

Definition at line 45 of file class.ilAuthModeDetermination.php.

◆ $settings

ilAuthModeDetermination::$settings = null
protected

Definition at line 42 of file class.ilAuthModeDetermination.php.

◆ TYPE_AUTOMATIC

const ilAuthModeDetermination::TYPE_AUTOMATIC = 1

Definition at line 37 of file class.ilAuthModeDetermination.php.

◆ TYPE_MANUAL

const ilAuthModeDetermination::TYPE_MANUAL = 0

Definition at line 36 of file class.ilAuthModeDetermination.php.


The documentation for this class was generated from the following file: