ILIAS  Release_5_0_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.ilShibbolethAuthenticationPluginInt.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  foreach ($this->getPluginObjects() as $pl) {
74  $user = $pl->beforeLogin($user);
75  }
76 
77  return $user;
78  }
79 
80 
86  public function afterLogin(ilObjUser $user) {
87  foreach ($this->getPluginObjects() as $pl) {
88  $user = $pl->afterLogin($user);
89  }
90 
91  return $user;
92  }
93 
94 
100  public function beforeCreateUser(ilObjUser $user) {
101  foreach ($this->getPluginObjects() as $pl) {
102  $user = $pl->beforeCreateUser($user);
103  }
104 
105  return $user;
106  }
107 
108 
114  public function afterCreateUser(ilObjUser $user) {
115  foreach ($this->getPluginObjects() as $pl) {
116  $user = $pl->afterCreateUser($user);
117  }
118 
119  return $user;
120  }
121 
122 
123  public function beforeLogout(ilObjUser $user) {
124  foreach ($this->getPluginObjects() as $pl) {
125  $user = $pl->beforeLogout($user);
126  }
127 
128  return $user;
129  }
130 
131 
137  public function afterLogout(ilObjUser $user) {
138  $this->log->write('afterlogout');
139  foreach ($this->getPluginObjects() as $pl) {
140  $user = $pl->afterLogout($user);
141  }
142 
143  return $user;
144  }
145 
146 
152  public function beforeUpdateUser(ilObjUser $user) {
153  foreach ($this->getPluginObjects() as $pl) {
154  $user = $pl->beforeUpdateUser($user);
155  }
156 
157  return $user;
158  }
159 
160 
166  public function afterUpdateUser(ilObjUser $user) {
167  foreach ($this->getPluginObjects() as $pl) {
168  $user = $pl->afterUpdateUser($user);
169  }
170 
171  return $user;
172  }
173 }
174 
175 ?>