ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilUserDB90.php
Go to the documentation of this file.
1 <?php
2 
19 use ILIAS\Setup;
20 use ILIAS\Refinery;
23 use ILIAS\UI;
24 
29 {
30  private const USER_DATA_TABLE_NAME = 'usr_data';
31 
32  protected ilDBInterface $db;
33 
34  public function prepare(ilDBInterface $db): void
35  {
36  $this->db = $db;
37  }
38 
39 
43  public function step_1(): void
44  {
45  if (!$this->db->tableColumnExists(self::USER_DATA_TABLE_NAME, 'rid')) {
46  $this->db->addTableColumn(
47  'usr_data',
48  'rid',
49  [
50  'type' => 'text',
51  'notnull' => false,
52  'length' => 64,
53  'default' => ''
54  ]
55  );
56  }
57  }
58 
62  public function step_2(): void
63  {
64  if ($this->db->tableColumnExists(self::USER_DATA_TABLE_NAME, 'passwd')) {
65  $this->db->modifyTableColumn(
66  'usr_data',
67  'passwd',
68  [
69  'type' => 'text',
70  'length' => 100,
71  'notnull' => false,
72  'default' => null
73  ]
74  );
75  }
76  }
77 
78  public function step_3(): void
79  {
80  $this->db->modifyTableColumn(
81  'usr_sess_istorage',
82  'session_id',
83  [
84  'type' => ilDBConstants::T_TEXT,
85  'length' => '256'
86  ]
87  );
88  }
89 
93  public function step_4(): void
94  {
95  $this->db->manipulate("DELETE FROM usr_pref WHERE keyword LIKE 'char_selector%'");
96  }
97 
98  public function step_5(): void
99  {
100  $query = 'ALTER TABLE ' . self::USER_DATA_TABLE_NAME . ' MODIFY firstname VARCHAR(128);';
101  $this->db->manipulate($query);
102  }
103  public function step_6(): void
104  {
105  $query = 'ALTER TABLE ' . self::USER_DATA_TABLE_NAME . ' MODIFY lastname VARCHAR(128);';
106  $this->db->manipulate($query);
107  }
108  public function step_7(): void
109  {
110  $query = 'ALTER TABLE ' . self::USER_DATA_TABLE_NAME . ' MODIFY email VARCHAR(128);';
111  $this->db->manipulate($query);
112  }
113  public function step_8(): void
114  {
115  $query = 'DELETE FROM rbac_ta WHERE typ_id=22 AND ops_id=48 ;';
116  $this->db->manipulate($query);
117  }
118  public function step_9(): void
119  {
120  $query = 'DELETE FROM settings WHERE module="common" AND keyword="user_adm_alpha_nav";';
121  $this->db->manipulate($query);
122  }
123 
124  public function step_10(): void
125  {
126  $query = 'SELECT value FROM settings WHERE module = %s AND keyword = %s';
127  $res = $this->db->queryF(
128  $query,
130  ['common', 'ps_login_max_attempts']
131  );
132 
133  // We should adjust the usr_data values, even if the "Max. Login Attempts" are currently not set
134  $max_login_attempts = min(
135  (int) ($this->db->fetchAssoc($res)['value'] ?? ilSecuritySettings::MAX_LOGIN_ATTEMPTS),
137  );
138 
139  $max_login_attempts_exceeded = $max_login_attempts + 1;
140 
141  $this->db->manipulateF(
142  'UPDATE usr_data SET login_attempts = %s WHERE login_attempts > %s',
144  [$max_login_attempts_exceeded, $max_login_attempts_exceeded]
145  );
146  }
147 }
const USER_DATA_TABLE_NAME
$res
Definition: ltiservices.php:69
step_2()
Modifies the &#39;passwd&#39; field in table &#39;usr_data&#39; to accept longer passwords.
step_1()
creates a column "rid" that is used to reference d IRSS Resource for a Profile Picture ...
prepare(ilDBInterface $db)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
step_4()
Remove the special charactor selector settings from the user preferences.
ilDBInterface $db