aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/User/Database.php
Commit message (Collapse)AuthorAgeFilesLines
* fix: Implement new interface instead of deprecated one in Database backendCôme Chilliet2025-01-141-5/+3
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* chore(db): Apply query prepared statementsdbQueriesExecStmt2Git'Fellow2024-10-171-8/+8
| | | | | | | | | | | | | | | | Fix: psalm fix: bad file fix: bug chore: add batch chore: add batch chore: add batch fix: psalm
* fix: Handle null checks with the ?? operatorrefactor/elvisChristoph Wurst2024-09-151-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* refactor: Use the elvis operatorChristoph Wurst2024-09-151-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* style: update codestyle for coding-standard 1.2.3Daniel Kesselberg2024-08-251-1/+1
| | | | Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
* feat: Validate password hashChristopher Ng2024-07-081-0/+4
| | | | Signed-off-by: Christopher Ng <chrng8@gmail.com>
* perf: Return cached password hashChristopher Ng2024-07-081-0/+3
| | | | Signed-off-by: Christopher Ng <chrng8@gmail.com>
* feat: Implement IPasswordHashBackend in database user backendChristopher Ng2024-07-081-1/+31
| | | | Signed-off-by: Christopher Ng <chrng8@gmail.com>
* chore: Add SPDX headerAndy Scherzinger2024-05-241-40/+3
| | | | Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
* Refactor `OC\Server::getHasher`Andrew Summers2024-03-151-3/+4
| | | | Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
* chore: Replace \OC::$server->query with \OCP\Server::get in /libChristoph Wurst2023-07-061-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Use typed version of IConfig::getSystemValue as much as possibleCôme Chilliet2023-04-051-1/+1
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Create the database user in a transactionThomas Citharel2023-03-151-11/+18
| | | | | | | | | | | | | | | In OC\User\Manager::createUserFromBackend the newly created user is read using getUserObject($uid, $backend) but that can cause causal read issues (wrote in DB primary, not yet in secondary). In OC\User\Database user backend the user cache is unset after the insert, so it can't be used by getRealUID() (which is called by getUserObject()). To avoid that we make sure the user cache is repopulated in a transaction. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
* Fix return type for countUsers methodCôme Chilliet2022-10-251-10/+10
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Fix creation of new user and display the correct error messageChristopher Ng2022-08-221-1/+3
| | | | Signed-off-by: Christopher Ng <chrng8@gmail.com>
* Move CappedMemoryCache to OCPCarl Schwan2022-07-141-1/+1
| | | | | | | | This is an helpful helper that should be used in more place than just server and this is already the case with groupfodlers, deck, user_oidc and more using it, so let's make it public Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* Do not save invalid display name to the databaseChristopher Ng2022-06-281-0/+4
| | | | Signed-off-by: Christopher Ng <chrng8@gmail.com>
* Fix psalm issues related to the user backendCarl Schwan2022-05-201-1/+1
| | | | | | | | | | | | | - Reflect the actual return value returned by the implementation in the the interface. E.g. IUser|bool -> IUser|false - Remove $hasLoggedIn parameter from private countUser implementation. Replace the two call with the equivalent countSeenUser - getBackend is nuallable, add this to the interface - Use backend interface to make psalm happy about call to undefined methods. Also helps with getting rid at some point of the old implementActions Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* Update cache when setting the passwordJoas Schilling2022-02-181-1/+7
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Use the cache also for UserBackend::getPasswordJoas Schilling2022-02-161-17/+6
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Fix type errorsCôme Chilliet2021-11-231-4/+5
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Update php licensesJohn Molakvoæ (skjnldsv)2021-06-041-14/+0
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Fix parameter types in docsJoas Schilling2021-03-171-2/+2
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Improve search results when only phonebook-matches can we autocompletedJoas Schilling2021-03-171-1/+43
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Bump doctrine/dbal from 2.12.0 to 3.0.0Christoph Wurst2021-01-081-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Update all license headers for Nextcloud 21Christoph Wurst2020-12-161-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Use matching parameter names form interfaces and implementationsMorris Jobke2020-08-191-4/+4
| | | | | | Found by Psalm 3.14.1 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Format code according to PSR2Christoph Wurst2020-04-101-2/+2
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Format control structures, classes, methods and functionChristoph Wurst2020-04-101-1/+0
| | | | | | | | | | | | | | | To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix (array) indent style to always use one tabChristoph Wurst2020-04-091-7/+7
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Remove unused importsChristoph Wurst2020-03-251-1/+0
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Update license headersChristoph Wurst2019-12-051-3/+5
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Add typed events for password_policyChristoph Wurst2019-11-271-8/+7
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Make sure limit is never negativeRoeland Jago Douma2019-10-281-0/+10
| | | | | | | | | There were some cases where a negative limit could be passed in. Which would happily make the query explode. This is just a quick hack to make sure it never is negative. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Get the proper UIDRoeland Jago Douma2019-08-131-1/+12
| | | | | | | | | | | | | | | | | | | | | Some user backends (like the database backend) allow us to obtain a user case insensitive. However the UID itself is case sensitive. Example: * create a user User1 * login as User1 - This results the data/User1 folder to be created etc * now have some code somewhere that obtains the userFolder (from IRootFolder) but pas in 'uSER1' as uid - The code will check if that is a valid user. And in this case it is since User1 and uSER1 both map to the same user - However the the UID in the user object is used for the folder a new folder fill be create data/uSER1 With this PR this is avoided now. Since we obtain the real UID casing in the backend before creating the user object. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add event dispatcher to OCPChristoph Wurst2019-06-251-3/+3
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* remove obsolete use statementsArthur Schiwon2019-04-241-2/+0
| | | | Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* Just update password hash without validatingRoeland Jago Douma2018-10-031-8/+12
| | | | | | | | | | | Fixes #11097 If your password hash changed (becuse your are on 7.2 and we moved to ARGON2). Then we shold not 'set a new password' but just update the hash. As else we invoke the password policy again which might lock out users. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* make table name configurable for db user backendRobin Appelman2018-06-191-9/+13
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* use query builder in all places in the db user backendRobin Appelman2018-06-151-13/+26
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* move log constants to ILoggerArthur Schiwon2018-04-261-1/+2
| | | | Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* Numeric only uids are no funRoeland Jago Douma2018-04-241-1/+4
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Cast retrieved DB fields to stringRoeland Jago Douma2018-04-241-4/+4
| | | | | | | | | | Fixes #9279 If a pure numerical user is in the DB the value might be casted to a int when returned. Cast it all to a string so we don't break the strict typing. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Use the uid_lower columnRoeland Jago Douma2018-04-061-24/+65
| | | | | | This can use a proper index Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Move to ABackendRoeland Jago Douma2018-03-221-2/+2
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Move Database backend over to new User/Backend interfacesRoeland Jago Douma2018-03-221-16/+30
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix configuration values matched in user searchesDaniel Calviño Sánchez2018-03-141-3/+3
| | | | | | | | | | | | | | | | Due to a misplaced closing parenthesis the condition of the left join clause was just "userid = uid"; the other conditions were passed as additional parameters to "leftJoin", and thus they were ignored. Therefore, the result set contained every preference of each user instead of only the email, so the "WHERE configvalue LIKE XXX" matched any configuration value of the user. Besides the closing parenthesis this commit also fixes the literal values. Although "Literal" objects represent literal values they must be created through "IExpressionBuilder::literal()" to be properly quoted; otherwise it is just a plain string, which is treated as a column name. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* refactor user searchingRobin Appelman2017-12-201-44/+44
| | | | | | add additional user searching tests Signed-off-by: Robin Appelman <robin@icewind.nl>
* Adds search by email function on the users screen.Abijeet2017-12-161-2/+11
| | | | | | | | | | | Fixes #7175. - Updated the query to fetch the users in users > everyone tab. - Updated the query to fetch the users in users > admin tab. - Tested to ensure that the disabled users are also being fetched. - Added test cases. Signed-off-by: Abijeet <abijeetpatro@gmail.com>
* Fix search in user managent when no group is selectedMorris Jobke2017-11-141-0/+2
| | | | | | * also allows to search by displayname Signed-off-by: Morris Jobke <hey@morrisjobke.de>