ILIAS  release_8 Revision v8.23
class.ilShibbolethPluginWrapper.php
Go to the documentation of this file.
1 <?php
2 /******************************************************************************
3  *
4  * This file is part of ILIAS, a powerful learning management system.
5  *
6  * ILIAS is licensed with the GPL-3.0, you should have received a copy
7  * of said license along with the source code.
8  *
9  * If this is not the case or you just want to try ILIAS, you'll find
10  * us at:
11  * https://www.ilias.de
12  * https://github.com/ILIAS-eLearning
13  *
14  *****************************************************************************/
15 
22 {
25  protected static ?ilShibbolethPluginWrapper $cache = null;
26 
27  protected function __construct()
28  {
29  global $DIC;
30  $ilLog = $DIC['ilLog'];
31  $this->log = $ilLog;
32  $this->component_factory = $DIC["component.factory"];
33  }
34 
35  public static function getInstance(): self
36  {
37  if (!self::$cache instanceof self) {
38  self::$cache = new self();
39  }
40 
41  return self::$cache;
42  }
43 
47  protected function getPluginObjects(): Iterator
48  {
49  return $this->component_factory->getActivePluginsInSlot('shibhk');
50  }
51 
52 
53  public function beforeLogin(ilObjUser $user): ilObjUser
54  {
55  foreach ($this->getPluginObjects() as $pl) {
56  $user = $pl->beforeLogin($user);
57  }
58 
59  return $user;
60  }
61 
62 
63  public function afterLogin(ilObjUser $user): ilObjUser
64  {
65  foreach ($this->getPluginObjects() as $pl) {
66  $user = $pl->afterLogin($user);
67  }
68 
69  return $user;
70  }
71 
72 
73  public function beforeCreateUser(ilObjUser $user): ilObjUser
74  {
75  foreach ($this->getPluginObjects() as $pl) {
76  $user = $pl->beforeCreateUser($user);
77  }
78 
79  return $user;
80  }
81 
82 
83  public function afterCreateUser(ilObjUser $user): ilObjUser
84  {
85  foreach ($this->getPluginObjects() as $pl) {
86  $user = $pl->afterCreateUser($user);
87  }
88 
89  return $user;
90  }
91 
92 
93  public function beforeLogout(ilObjUser $user): ilObjUser
94  {
95  foreach ($this->getPluginObjects() as $pl) {
96  $user = $pl->beforeLogout($user);
97  }
98 
99  return $user;
100  }
101 
102 
103  public function afterLogout(ilObjUser $user): ilObjUser
104  {
105  $this->log->write('afterlogout');
106  foreach ($this->getPluginObjects() as $pl) {
107  $user = $pl->afterLogout($user);
108  }
109 
110  return $user;
111  }
112 
113 
114  public function beforeUpdateUser(ilObjUser $user): ilObjUser
115  {
116  foreach ($this->getPluginObjects() as $pl) {
117  $user = $pl->beforeUpdateUser($user);
118  }
119 
120  return $user;
121  }
122 
123 
124  public function afterUpdateUser(ilObjUser $user): ilObjUser
125  {
126  foreach ($this->getPluginObjects() as $pl) {
127  $user = $pl->afterUpdateUser($user);
128  }
129 
130  return $user;
131  }
132 }
Class ilShibbolethPluginWrapper.
Component logger with individual log levels by component id.
static ilShibbolethPluginWrapper $cache
global $DIC
Definition: feed.php:28