forked from glpi-project/glpi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add user_dn_hash field to improve User::getFromDBbyDn performan…
…ce (glpi-project#16096) * feat(user): optimize User::getFromDBbyDn() by adding user_dn_hash fix(auth-ldap): unset user_dn_hash for sql insert feat(composer.json): add ext-hash to required PHP extensions Revert "feat(composer.json): add ext-hash to required PHP extensions" This reverts commit 370b4f4. chore: Update ComposerRequireChecker config to whitelist hash function Revert "chore: Update ComposerRequireChecker config to whitelist hash function" This reverts commit 8e3cdc9. fix: use md5 algo and drop virtual key usage * Apply suggestions from code review Co-authored-by: Cédric Anne <[email protected]> * refactor(user): Update user_dn_hash directly in pre_addInDB/pre_updateInDB * test(user): Ensure user_dn_hash is emptied when user_dn is set to empty or null --------- Co-authored-by: Cédric Anne <[email protected]>
- Loading branch information
1 parent
9aad0a1
commit 0a25d81
Showing
5 changed files
with
170 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
/** | ||
* --------------------------------------------------------------------- | ||
* | ||
* GLPI - Gestionnaire Libre de Parc Informatique | ||
* | ||
* http://glpi-project.org | ||
* | ||
* @copyright 2015-2023 Teclib' and contributors. | ||
* @copyright 2003-2014 by the INDEPNET Development Team. | ||
* @licence https://www.gnu.org/licenses/gpl-3.0.html | ||
* | ||
* --------------------------------------------------------------------- | ||
* | ||
* LICENSE | ||
* | ||
* This file is part of GLPI. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
* --------------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* @var \DBmysql $DB | ||
* @var \Migration $migration | ||
*/ | ||
|
||
// Add user_dn_hash field | ||
$migration->addField('glpi_users', 'user_dn_hash', 'varchar(32)', [ | ||
'after' => 'user_dn', | ||
]); | ||
|
||
$migration->addPostQuery($DB->buildUpdate( | ||
'glpi_users', | ||
[ | ||
'user_dn_hash' => new \QueryExpression('MD5(`user_dn`)'), | ||
], | ||
[ | ||
'NOT' => [ | ||
'user_dn' => null | ||
] | ||
] | ||
)); | ||
|
||
// Add user_dn_hash index | ||
$migration->addKey('glpi_users', 'user_dn_hash'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters