ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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  $this->component_factory = $DIC["component.factory"];
31  $this->log = $DIC['ilLog'];
32  }
33 
34  public static function getInstance(): self
35  {
36  if (!self::$cache instanceof self) {
37  self::$cache = new self();
38  }
39 
40  return self::$cache;
41  }
42 
43  protected function getPluginObjects(): Iterator
44  {
45  return $this->component_factory->getActivePluginsInSlot('shibhk');
46  }
47 
48 
49  public function beforeLogin(ilObjUser $user): ilObjUser
50  {
51  foreach ($this->getPluginObjects() as $pl) {
52  $user = $pl->beforeLogin($user);
53  }
54 
55  return $user;
56  }
57 
58 
59  public function afterLogin(ilObjUser $user): ilObjUser
60  {
61  foreach ($this->getPluginObjects() as $pl) {
62  $user = $pl->afterLogin($user);
63  }
64 
65  return $user;
66  }
67 
68 
69  public function beforeCreateUser(ilObjUser $user): ilObjUser
70  {
71  foreach ($this->getPluginObjects() as $pl) {
72  $user = $pl->beforeCreateUser($user);
73  }
74 
75  return $user;
76  }
77 
78 
79  public function afterCreateUser(ilObjUser $user): ilObjUser
80  {
81  foreach ($this->getPluginObjects() as $pl) {
82  $user = $pl->afterCreateUser($user);
83  }
84 
85  return $user;
86  }
87 
88 
89  public function beforeLogout(ilObjUser $user): ilObjUser
90  {
91  foreach ($this->getPluginObjects() as $pl) {
92  $user = $pl->beforeLogout($user);
93  }
94 
95  return $user;
96  }
97 
98 
99  public function afterLogout(ilObjUser $user): ilObjUser
100  {
101  $this->log->log('afterlogout');
102  foreach ($this->getPluginObjects() as $pl) {
103  $user = $pl->afterLogout($user);
104  }
105 
106  return $user;
107  }
108 
109 
110  public function beforeUpdateUser(ilObjUser $user): ilObjUser
111  {
112  foreach ($this->getPluginObjects() as $pl) {
113  $user = $pl->beforeUpdateUser($user);
114  }
115 
116  return $user;
117  }
118 
119 
120  public function afterUpdateUser(ilObjUser $user): ilObjUser
121  {
122  foreach ($this->getPluginObjects() as $pl) {
123  $user = $pl->afterUpdateUser($user);
124  }
125 
126  return $user;
127  }
128 }
Class ilShibbolethPluginWrapper.
Component logger with individual log levels by component id.
static ilShibbolethPluginWrapper $cache
global $DIC
Definition: shib_login.php:25