ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilShibbolethPluginWrapper.php
Go to the documentation of this file.
1 <?php
2 require_once('./Services/AuthShibboleth/interfaces/interface.ilShibbolethAuthenticationPlugin.php');
3 
10 
14  protected $plugin_admin;
18  protected $log;
22  protected static $active_plugins = array();
26  protected static $cache = NULL;
27 
28 
29  protected function __construct() {
30  global $ilPluginAdmin, $ilLog;
31  $this->log = $ilLog;
32  $this->plugin_admin = $ilPluginAdmin;
33  if (self::$active_plugins == NULL) {
34  self::$active_plugins = $this->plugin_admin->getActivePluginsForSlot(IL_COMP_SERVICE, 'AuthShibboleth', 'shibhk');
35  }
36  }
37 
38 
42  public static function getInstance() {
43  if (! self::$cache instanceof ilShibbolethPluginWrapper) {
44  self::$cache = new self();
45  }
46 
47  return self::$cache;
48  }
49 
50 
54  protected function getPluginObjects() {
55  $plugin_objs = array();
56  foreach (self::$active_plugins as $plugin_name) {
57  $plugin_obj = $this->plugin_admin->getPluginObject(IL_COMP_SERVICE, 'AuthShibboleth', 'shibhk', $plugin_name);
58  if ($plugin_obj instanceof ilShibbolethAuthenticationPlugin) {
59  $plugin_objs[] = $plugin_obj;
60  }
61  }
62 
63  return $plugin_objs;
64  }
65 
66 
72  public function beforeLogin(ilObjUser $user) {
73  // $this->log->write('ilShibbolethPluginWrapper::beforeLogin');
74  foreach ($this->getPluginObjects() as $pl) {
75  $user = $pl->beforeLogin($user);
76  }
77 
78  return $user;
79  }
80 
81 
87  public function afterLogin(ilObjUser $user) {
88  foreach ($this->getPluginObjects() as $pl) {
89  $user = $pl->afterLogin($user);
90  }
91 
92  return $user;
93  }
94 
95 
101  public function beforeCreateUser(ilObjUser $user) {
102  foreach ($this->getPluginObjects() as $pl) {
103  $user = $pl->beforeCreateUser($user);
104  }
105 
106  return $user;
107  }
108 
109 
115  public function afterCreateUser(ilObjUser $user) {
116  foreach ($this->getPluginObjects() as $pl) {
117  $user = $pl->afterCreateUser($user);
118  }
119 
120  return $user;
121  }
122 
123 
124  public function beforeLogout(ilObjUser $user) {
125  foreach ($this->getPluginObjects() as $pl) {
126  $user = $pl->beforeLogout($user);
127  }
128 
129  return $user;
130  }
131 
132 
138  public function afterLogout(ilObjUser $user) {
139  $this->log->write('afterlogout');
140  foreach ($this->getPluginObjects() as $pl) {
141  $user = $pl->afterLogout($user);
142  }
143 
144  return $user;
145  }
146 
147 
153  public function beforeUpdateUser(ilObjUser $user) {
154  foreach ($this->getPluginObjects() as $pl) {
155  $user = $pl->beforeUpdateUser($user);
156  }
157 
158  return $user;
159  }
160 
161 
167  public function afterUpdateUser(ilObjUser $user) {
168  foreach ($this->getPluginObjects() as $pl) {
169  $user = $pl->afterUpdateUser($user);
170  }
171 
172  return $user;
173  }
174 }
175 
176 ?>