Commit Graph

717 Commits

Author SHA1 Message Date
Morris Jobke a661f043e1
Remove unneeded semicolon and parentheses
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 23:46:40 +01:00
Morris Jobke 2ad2eb38e8
Use type casting instead of *val() method
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 15:01:27 +01:00
Morris Jobke ca493ab5b1
Merge pull request #8069 from nextcloud/no-catch-serverdown
do not catch and ignore ServerNotAvailable in the wrong spot
2018-01-26 14:01:07 +01:00
Arthur Schiwon b61b906abe
do not catch ServerNotAvailable
might cause the user to be unavailable (race condition).

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-26 12:47:19 +01:00
Morris Jobke 6bbea33133
Simplify ternary operator statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 12:36:25 +01:00
Morris Jobke c1e4f9f305
Use type casting instead of *val() method
It should be up to 6x faster

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 11:35:42 +01:00
Morris Jobke 0a56d2185e
Return value immediately instead of assigning to a one-time variable
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 00:02:03 +01:00
Morris Jobke 2a38605545
Properly log the full exception instead of only the message
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-23 10:57:21 +01:00
Morris Jobke 55532f19d9
Cleanup OC_User and OCP\User
* mainly removes deprecated methods and old static code

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-16 18:39:11 +01:00
Roeland Jago Douma 8a41d05761
Remove deprecated \OCP\Config
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-13 14:25:04 +01:00
Arthur Schiwon f84ec92563
revert resolving of recursion (3628d4d65d)
without recursion we have issues with internal states. paged search status
are set to false, cookies are not being set. In the end we have  endless
requests which pile up enormously with a high initial offset.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-11 15:17:18 +01:00
Arthur Schiwon 9031ae0281
fix return value when ldapPagingSize returns null
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-11 14:47:51 +01:00
Arthur Schiwon 15a3f4659f
enrich log message with backtrace, but level it down to DEBUG
The message is not helpful anyway for an admin, and oftentimes is just
valid (e.g. when searching with an offset beyond users in LDAP).

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-11 14:17:14 +01:00
Arthur Schiwon f292f98060
when paged results are turned off, all (max possible) users are returned
thus hasMoreResult should return false

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-11 13:20:17 +01:00
Arthur Schiwon 7c3db54ff6
fix changing to next cycle
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-08 13:45:06 +01:00
Arthur Schiwon b17c5fec40
add unit test for qualifies to run
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-08 13:08:59 +01:00
Arthur Schiwon a565bf0b9f
fix offset is never being reset
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-05 14:29:11 +01:00
Arthur Schiwon 82da4fde18
create failing test for this case
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-05 14:27:36 +01:00
Morris Jobke 4d0315ceae
Merge pull request #7599 from nextcloud/quieter-debug-log
don't show recurring log msg when paged result was turned off
2018-01-03 00:40:46 +01:00
Arthur Schiwon c8851e24a8
throw ServerNotAvailableException when LDAP is caught shutting down
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-02 12:20:44 +01:00
Arthur Schiwon 82fd09c294
don't show recurring msg when pages result was turned off
and only as debug level otherwise.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-12-21 14:29:56 +01:00
Morris Jobke d2d73f1ce8
Also replace all other occurences
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-12-18 20:57:11 +01:00
Arthur Schiwon 5ce943aa85
don't use deprecated method for requesting memcache
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-12-18 20:57:11 +01:00
Morris Jobke defac0ff0d
Fixes hex2bin() in LDAP
Untangles the two if-else clauses into a more readable format.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-12-13 11:57:49 +01:00
Arthur Schiwon 27f14eee26
don't cache user, if no internal user id was retrieved/assigned
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-12-07 22:47:32 +01:00
Arthur Schiwon 991190b994
ensure that users are cached when they are retrieved
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-12-07 17:49:33 +01:00
sidey79 45dfc11137
tryfix needsRefresh unit tests
Forced updateAttributesInterval from getAppValue to int

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-11-10 17:07:41 +01:00
sidey79 039f6c9636
Fixed Typo in user.php
Fixed a typo for the app config prameter updateAttributesInterval

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-11-10 17:07:41 +01:00
sidey79 0b290c0904
Update User.php
Makes the time between needsRefresh configurable via app config option updateAttribuesInterval.
Default is still 86400 secons which is one day.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-11-10 17:07:36 +01:00
Arthur Schiwon 419759e68b
resolve DI
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-11-09 11:10:59 +01:00
Arthur Schiwon 8113f26eed
add Sync test
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-11-09 11:10:58 +01:00
Arthur Schiwon 59c05d5447
move LDAP user attributes "sync" to background (except for ajax jobs)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-11-09 11:10:56 +01:00
Arthur Schiwon ef3cd32916
don't skip updating when ajax is set as background job mode
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-11-09 11:10:04 +01:00
Arthur Schiwon c6f1af9896
move ldap user sync to background (WIP)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-11-09 11:09:59 +01:00
Lukas Reschke 2bfa1ce5c3
Merge pull request #5568 from nextcloud/ldap-agent-credentials-safe
Ldap agent credentials save
2017-11-09 09:26:51 +01:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Vinicius Cubas Brand fa565750d1 User_LDAP plugins: smaller fixes
Signed-off-by: Vinicius Cubas Brand <viniciuscb@gmail.com>
2017-11-03 11:42:59 -02:00
Vinicius Cubas Brand 10ca793452 Plugins infrastructure in User_LDAP
Signed-off-by: Vinicius Cubas Brand <viniciuscb@gmail.com>
2017-11-03 11:41:40 -02:00
Arthur Schiwon 7b0868ddac
fix saving changes…
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-10-27 14:25:19 +02:00
Arthur Schiwon 9a1f706ae4
fix creating an empty configuration
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-10-27 14:25:19 +02:00
Arthur Schiwon 52b1b97c58
Fix regression: undesired writes to the DB
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-10-27 14:25:19 +02:00
Arthur Schiwon 4eab39f133
LDAP: only write actually changes values to the DB
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-10-27 14:25:19 +02:00
Arthur Schiwon 3628d4d65d
avoid unnecessary recursion
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-10-25 17:23:42 +02:00
Lukas Reschke 9932b7498d Merge pull request #6873 from nextcloud/ldap_proxy_redix_fix
Ldap proxy Redis fix
2017-10-19 12:03:04 +02:00
Lukas Reschke 7de6f7cd07 Merge pull request #6677 from nextcloud/downstream-dont-reset-quota
don't reset quota
2017-10-19 11:42:37 +02:00
Roeland Jago Douma 4388ec2231
Little bit of code cleanup
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-10-19 11:05:24 +02:00
Roeland Jago Douma a6760560c6
Do not check existance before fetch
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-10-19 11:03:31 +02:00
Arthur Schiwon c9622ccb62
fix LDAP User deletion (cleanup)
discovered a bug in the integration test which lead to following a
different code path and giving a false-positive  success feedback.

Also listens now to the evendispatcher instead of old hook system

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-09-29 11:44:04 +02:00
Arthur Schiwon 3e2015a24c
and add missing whitespaces to log outout
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-09-28 01:16:57 +02:00
Juan Pablo Villafáñez d6d895dd74
Keep the current quota if no suitable quota is found
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-09-28 01:13:48 +02:00
Arthur Schiwon 5e74affea4
fix counting found results in search op
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-09-14 13:20:51 +02:00
Arthur Schiwon 34f9590169
replace hard-coded attribute with the corresponding settings option
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-09-14 13:20:51 +02:00
Arthur Schiwon 89f4e16cdb
fix limit-flaw in search on paged results
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-09-14 13:20:51 +02:00
Morris Jobke ba2e1c5db9 Merge pull request #5689 from nextcloud/fix-4117
LDAP: simplify returning the homePath and fixing #4117
2017-09-14 00:23:01 +02:00
Morris Jobke cebbb1633a Merge pull request #5642 from tobru/fix/groupOfUniqueNames_in_Wizard
recognize groupOfUniqueNames as valid LDAP group object
2017-09-05 13:33:15 +02:00
Morris Jobke ff93dd7eb1 Merge pull request #5466 from jlehtoranta/ldap-connectivity-fixes
LDAP Connectivity Fixes
2017-09-04 18:31:32 +02:00
Arthur Schiwon ab92e2ee14
listen to deletion hooks for proper handling, adjust and add tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-08-31 23:03:21 +02:00
Arthur Schiwon efedc81c0a
simplify returning the homePath and fixing #4117
homesToKill was not set in runtime since some changes some place else. It
required deleteUser() to be called first. The method acts independent of it
now.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-08-31 23:03:16 +02:00
Morris Jobke 43facdb95f Merge pull request #5616 from nextcloud/ldap-wizard-remove-LDAPTLS_REQCERT-attempt
LDAP Wizard: do not attempt to recognise cert issue by using LDAPTLS_REQCERT
2017-08-10 21:06:14 +02:00
Joas Schilling 45e2c415d4 Fix comparison in the ldap app
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-08-01 13:56:12 +02:00
Roeland Jago Douma ede15f0988
Fix L10N::t
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-08-01 08:20:17 +02:00
Morris Jobke c27498db71 Use IConfig instead of static OCP\Config
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-07-27 13:43:18 +02:00
Morris Jobke 89a7b007f2 Fix comments
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-07-25 08:57:58 +02:00
Jarkko Lehtoranta 69f6d42b17 LDAP: Simplify conditions in establishConnection
Signed-off-by: Jarkko Lehtoranta <devel@jlranta.com>
2017-07-23 14:50:01 +03:00
Jarkko Lehtoranta 6103677a91 LDAP: Use imported exception in Connection class
Signed-off-by: Jarkko Lehtoranta <devel@jlranta.com>
2017-07-23 14:50:01 +03:00
Jarkko Lehtoranta 79fbed4064 LDAP: Clean-up doConnect
Signed-off-by: Jarkko Lehtoranta <devel@jlranta.com>
2017-07-23 14:50:01 +03:00
Jarkko Lehtoranta d87375cbaa LDAP: Throw an exception if disabling LDAP referrals fails
Signed-off-by: Jarkko Lehtoranta <devel@jlranta.com>
2017-07-23 14:50:01 +03:00
Jarkko Lehtoranta de9a9bc004 LDAP: Throw an exception if Start TLS fails
This ensures that only a secure connection to the LDAP server will be used,
if Start TLS has been enabled.

Signed-off-by: Jarkko Lehtoranta <devel@jlranta.com>
2017-07-23 14:50:01 +03:00
Jarkko Lehtoranta ee2c6e8215 LDAP: Remove unnecessary "recursion" fix
This reverts commit 86d72b9a61
"LDAP: fix possible recursion".

Signed-off-by: Jarkko Lehtoranta <devel@jlranta.com>
2017-07-23 14:50:01 +03:00
Jarkko Lehtoranta 039a836d4a LDAP: Don't handle invalid credentials as a connection error
Signed-off-by: Jarkko Lehtoranta <devel@jlranta.com>
2017-07-23 14:50:01 +03:00
Jarkko Lehtoranta 4e2e592635 LDAP: Connect to backup server only if it exists + handle errors
Signed-off-by: Jarkko Lehtoranta <devel@jlranta.com>
2017-07-23 14:50:01 +03:00
Arthur Schiwon 25439919f8
fix phpdoc return types (no code change)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-07-21 14:55:12 +02:00
Arthur Schiwon 9b2f171cbd
do not attempt to recognise cert issue by using LDAPTLS_REQCERT
first, it does not work (at least not everywhere/reliably), second if it
did it was not reset properly. Removes a bit of complexity.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-07-21 14:55:11 +02:00
Allan Nordhøy ddc804aa32 : Bigversal and LDAP 2017-07-14 15:46:05 +02:00
Roger Szabo 0ebec6f9a4 Rectify variable $uid->$user
Signed-off-by: Roger Szabo <roger.szabo@web.de>
2017-07-10 18:46:39 +08:00
Tobias Brunner f8735a3205 recognize groupOfUniqueNames as valid LDAP group object
This was already partly done in f88109b but was missed in the
fetchGroups function.
2017-07-07 08:29:58 +02:00
Roger Szabo 51ecc7ce11 suppress superflous php error on rejected password change
Signed-off-by: Roger Szabo <roger.szabo@web.de>
2017-06-30 18:36:33 +08:00
Roger Szabo bf9412df63 set needsPasswordReset flag correctly
Signed-off-by: Roger Szabo <roger.szabo@web.de>
2017-06-22 15:58:30 +08:00
Roger Szabo 0fcbc0954c pass missing function parameter
Signed-off-by: Roger Szabo <roger.szabo@web.de>
2017-06-21 14:40:44 +08:00
Arthur Schiwon b79f9cadc2
fix paging
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-05-26 13:44:43 +02:00
Arthur Schiwon bd5d12528f
make sure used ldap connection resource is always up to date
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-05-25 00:45:48 +02:00
bline 8c89bf7c59
moved to something a little less invasive. back to passing CR around.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-05-25 00:36:51 +02:00
bline 8829d84949
special case for controlPagedResultResponse. It would be nice if there was a generic way to pass by reference with call_user_func_array..
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-05-25 00:34:52 +02:00
Morris Jobke ba43a09380 Merge pull request #4512 from nextcloud/fix-translations-2
Fix translations
2017-04-26 08:57:08 -03:00
Joas Schilling 6c28c4ac8b
Use correct plural form and add special strings for tomorrow and today
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-04-26 09:34:59 +02:00
Arthur Schiwon 43f451e9e0
Fix usersInGroup retrieval
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-04-25 15:07:05 +02:00
Arthur Schiwon 685faad5ca
fix method name due to changes in master
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2017-04-25 13:03:08 +02:00
Arthur Schiwon b1d646640a
Merge branch 'master' of https://github.com/Xuanwo/server into Xuanwo-master2 2017-04-25 12:42:17 +02:00
Xuanwo 8db21ad8c8 user_ldap: Add support for gidNumber
This patch is based on the work of @dleeuw (https://github.com/dleeuw)
(See https://github.com/nextcloud/server/issues/2640#issuecomment-269615883 for more details).
The difference is user & group data will be written into cache to have
better performance, and functions splited from primaryGroupID series to
make them more readable.

Fixed https://github.com/nextcloud/server/issues/2640

Signed-off-by: Xuanwo <xuanwo@yunify.com>
2017-04-25 10:06:47 +08:00
blizzz 42e805f057 Merge pull request #1023 from GitHubUser4234/ldap_password_renew_pr
Handle password expiry in user_ldap
2017-04-24 12:17:04 +02:00
Lukas Reschke 727688ebd9
Adjust existing bruteforce protection code
- Moves code to annotation
- Adds the `throttle()` call on the responses on existing annotations

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-04-14 13:42:40 +02:00
Morris Jobke 229d17e13b
Change LDAP method names
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-04-12 10:10:07 -05:00
Morris Jobke 1729e4471f
Update comments to Nextcloud
* based on PR by @Ardinis
* see #4311

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-04-11 23:16:27 -05:00
Roger Szabo 5fa218051b unit test adjustment
Signed-off-by: Roger Szabo <roger.szabo@web.de>
2017-04-07 18:06:50 +08:00
Roger Szabo f49ff74943 blizzz comments 03.04.2017 with caching
Signed-off-by: Roger Szabo <roger.szabo@web.de>
2017-04-06 16:57:07 +08:00
Roger Szabo 33c8bf1857 blizzz comments 03.04.2017
Signed-off-by: Roger Szabo <roger.szabo@web.de>
2017-04-06 16:26:41 +08:00
Roger Szabo 1853c1ade2 remove redundant tabs
Signed-off-by: Roger Szabo <roger.szabo@web.de>
2017-03-31 15:27:50 +08:00
Roger Szabo 5e7723f15c restore ldap_password_renew_pr
Signed-off-by: Roger Szabo <roger.szabo@web.de>
2017-03-31 15:16:22 +08:00
Roeland Jago Douma 70f93bf53a Merge pull request #4143 from nextcloud/ldap-downstream-64
Correctly apply quota
2017-03-30 14:10:21 +02:00
Morris Jobke d17678b5b2 Merge pull request #4141 from nextcloud/ldap-downstream-9
Convert the group limit to match the same behaviour as the user search
2017-03-29 15:47:28 -06:00