Commit Graph

1224 Commits (5c49a54801b73afd4ed5ae688206637efd70ce2b)

Author SHA1 Message Date
Côme Chilliet 6ed0d0b8b1 Refactor group membership listing for nested groups
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-10-20 12:09:06 +07:00
Côme Chilliet 8b19cfcd88 Small optimisation of _groupMembers
This will not change the result as users are check to be existing
 afterwards but avoids this check when we know it’s a group.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-10-20 12:09:06 +07:00
Côme Chilliet d07f43dc12 Refactor _groupMembers to correctly use cache on intermediate results
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-10-20 12:09:06 +07:00
Carl Schwan 6522f8a6d9 Fix merging list with null
This fixes some cases observed with the debugger where we end up merging
a non empty list with null. The result is then null and the looping over
the items would then end.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-10-20 12:09:06 +07:00
Carl Schwan 49aa352069 Unify a bit the types of the fetcher
Now it will only accept a string as parameter instead of either a string
(DN) or a array (complete record).

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-10-20 12:09:06 +07:00
Carl Schwan 0fd7a51e3c Add more type hinting
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-10-20 12:09:06 +07:00
Arthur Schiwon 5647093319 Cache intermediates
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Co-authored-by: Carl Schwan <carl@carlschwan.eu>
2022-10-20 12:08:34 +07:00
Arthur Schiwon ad2fdbe377 Refactor code to split common loop
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-10-20 12:08:24 +07:00
Arthur Schiwon 1e4ac22c94 Make it possible to return nested records whem walking over groups
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-10-20 12:08:09 +07:00
Arthur Schiwon 50d4963772
[LDAP] throw exception only against prov api
- unbreaks functionality for end users when on demand mapping takes
  place

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-10-18 23:26:16 +07:00
Arthur Schiwon 8e8acf2d90
LDAP to no register new users when outside of fair use or over limits
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-10-18 12:57:43 +07:00
Côme Chilliet 1d2d6e864d
Avoid double ldap_unbind in Wizard.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-10-11 09:54:04 +07:00
Côme Chilliet 0a9a749174
Fix code style with codesniffer
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-10-11 09:53:27 +07:00
Vincent Van Houtte c323022d06 Add ldap-unix-socket support - squashed commits to files Connection.php, Configuration.php, Wizard.php, LDAP.php and view.js
Signed-off-by: Vincent Van Houtte <vvh@aplusv.be>
2022-09-09 16:53:05 +07:00
luz paz 9d26671f05 Fix typos in apps/ subdirectory
Found via `codespell -q 3 -S l10n,./apps/files_external/3rdparty -L adn,ba,boxs,keypair,jus,optionel,ressource,tabel ./apps/`

Signed-off-by: luz paz <luzpaz@github.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2022-09-05 12:59:54 +07:00
Carl Schwan b888c61463
Merge pull request #33047 from nextcloud/fix/ijob-logger-deprecated
Deprecated ILogger from IJob
2022-08-23 16:55:42 +07:00
Joas Schilling f4885ee3ba
Remove unused method
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-08-22 14:15:32 +07:00
Joas Schilling ef60257110
Fix plural usage in LDAP wizard
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-08-22 14:14:47 +07:00
Carl Schwan 48d9c4d2b0
Port existing server code to new interface
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-08-08 17:03:19 +07:00
Carl Schwan d5c23dbb9f Move CappedMemoryCache to OCP
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>
2022-07-14 15:54:31 +07:00
blizzz 52c957e751
simplify
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>

Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
2022-06-28 16:07:11 +07:00
Arthur Schiwon d97f32dd8e
delete groups in chunks instead of one by one
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-06-28 14:35:18 +07:00
Arthur Schiwon 632f2d7760
cleanup LDAP's UpdateGroups
- TimedJob from API
- DI of config
- property types
- throws hints in phpdoc
- argument and return types
- replace depracet execute() with executeStatement or -Query
- a missing return statement

Co-authored-by: Carl Schwan <carl@carlschwan.eu>

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-06-28 14:34:56 +07:00
Carl Schwan 35d8bdc840 Fix profiler trying to serialize invalid utf8
The cookie value contains invalid utf8 characters most of the time so
let's just ignore it as it is also not that interesting to analyse.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-06-20 11:11:12 +07:00
Carl Schwan ec6b83cc18 Add stricter psalm type for CappedMemoryCache
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-05-12 15:06:18 +07:00
Carl Schwan 95b5187300 Don't use slow hashing to check the LDAP binding
Using password_hash is expensive and should be used for hashing
passwords when saving them in the database. Here we just want to see if
the bind was already done with the given password, so use a fast hashing
algorythm.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-05-05 16:29:38 +07:00
John Molakvoæ 1e5a879d2e
Fix createNamedParameter in LDAP migrations
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2022-04-07 11:34:13 +07:00
blizzz 835e28d0b2
Merge pull request #31661 from nextcloud/enh/user_ldap-add-command-to-unmap-groups
Add ldap:reset-group command to unmap groups from LDAP
2022-04-05 10:57:33 +07:00
Carl Schwan 135bdb3d58
Merge pull request #30823 from nextcloud/work/profiler
Built-in profiler

This adds the required API for collecting information about requests. This information
can then be displayed with the new 'profiler' app.
2022-04-04 12:56:37 +07:00
Carl Schwan 7d272c54d0 Add a built-in profiler inside Nextcloud
The webui is provided by a seperate application named profiler

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-04-04 10:28:26 +07:00
Côme Chilliet d7a291039d Fix user_ldap unit tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-01 12:18:03 +07:00
Côme Chilliet 91d6e88c2f Add missing file
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-01 12:18:03 +07:00
Côme Chilliet a2c030ffea Add type information to fix psalm error
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-01 12:18:02 +07:00
Côme Chilliet 77bdad84c2 Add ldap:reset-group command to unmap groups from LDAP
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-01 12:18:02 +07:00
Christoph Wurst 9c922ed15a Fix assignment of the LDAP Wizard connection
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-03-31 14:42:39 +07:00
Côme Chilliet 9fc00fdb82 Avoid updating _lastChange when nothing is changed in the configuration
Had to set at least one var when creating an empty configuration in
 order to save the default values.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-31 08:38:05 +07:00
Côme Chilliet bd9c4fbc07 Do not update _lastChanged on auto-detected attributes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-31 08:38:05 +07:00
Côme Chilliet d07208bd2c Use the new octetLength function to filter lines to migrate
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-30 14:43:09 +07:00
Côme Chilliet 6c7ba01dfe Adapt max length limit in AbstactMapping to match database
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-30 14:43:09 +07:00
Arthur Schiwon 52b57eb753 shrink ldap_dn column to 4000
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-30 14:43:08 +07:00
Arthur Schiwon 2f49f4a0fe limit ldap_dn columns to 4000
- enlarging string cols from 255 to more than 4000 fails on default
  Oracle installations for invalid datatype conversion

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-30 14:43:08 +07:00
Côme Chilliet efebbacca4 Add octetLength and charLength to function builder, and tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 20:35:02 +07:00
Côme Chilliet 7dc3eb1e9e Use getLengthExpression to measure field length instead of like
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 20:35:02 +07:00
Arthur Schiwon 4656753df0
do not forget DB table prefix with truncate query
- as used in LDAP's AbstractMapping::clear() method
- and in Comment's ManagerTest::setUp()
- fixes a DB Exception with Oracle

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-18 16:59:46 +07:00
Côme Chilliet 475a859aae
Merge pull request #31421 from nextcloud/fix/user_ldap-fix-ldap-connection-resets
user_ldap fix ldap connection resets
2022-03-17 09:13:44 +07:00
Carl Schwan 371fa1c49a
Merge pull request #31542 from nextcloud/psalm-userCounts
Fix psalm issue about userCounts
2022-03-14 11:27:43 +07:00
Carl Schwan 1bf5ab35a8 Use "use" to import namespaces
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-03-14 09:35:01 +07:00
Carl Schwan 8d7380a15d Fix psalm issue about userCounts
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-03-11 14:17:29 +07:00
Côme Chilliet ccab35f23f
Fix similar potential problems with fetchOne loops
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-08 12:10:52 +07:00
Côme Chilliet 65a866556b
Fix duplicated UUID detection when there are empty uuids
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-08 11:57:33 +07:00
Côme Chilliet df29acb343
Set $limit as int as well in Access::count private method
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-08 10:21:54 +07:00
Arthur Schiwon 16b6504cc6
code style
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-03 21:32:54 +07:00
Arthur Schiwon f3668f2748
be conservative when reading from fresh created column
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-03 21:26:18 +07:00
Côme Chilliet dab5ea958a
Fix unit tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-03 16:35:06 +07:00
Côme Chilliet 0c5bd588ed
Fix types in OCA\User_LDAP\Configuration
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-03 11:53:50 +07:00
Côme Chilliet e80eb79a1e
Remove redundant is_array check
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-03 11:41:59 +07:00
Côme Chilliet fb63484ced
Improve typing in user_ldap to detect problems early
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-03 11:12:09 +07:00
Côme Chilliet 8349530fb4
Fix executeRead when connection is reset because of a timeout
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-03 10:24:07 +07:00
Côme Chilliet 44680b5c3b
Make it explicit that a DN can be used for ldap:check-user
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-17 10:00:25 +07:00
Côme Chilliet a6ad06f940
Improve typing in apps/user_ldap/lib/Command/CheckUser.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-17 09:58:51 +07:00
Côme Chilliet a4f96c18e9
Remove parenthesis around return in apps/user_ldap/lib/Command/CheckUser.php
Co-authored-by: Carl Schwan <carl@carlschwan.eu>

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-17 09:58:51 +07:00
Côme Chilliet 75ce9a4832
Fix ldap:check-user method for newly created LDAP users
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-17 09:58:28 +07:00
Vincent Petry cd1bf94181
Merge pull request #31073 from nextcloud/fix/user_ldap-fix-access-typing
Improve typing in OCA\User_LDAP\Access and reduce psalm errors
2022-02-10 17:53:58 +07:00
Côme Chilliet bcfe99cc62
Fix psalm errors in apps/user_ldap/lib/Jobs/CleanUp.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-10 10:15:00 +07:00
Côme Chilliet 9f2db6e65d
Fix ldap:update-uuid
Generators cannot be iterated with while or returned by an other
 generator, using foreach instead.
And a few other problems.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-10 10:15:00 +07:00
Arthur Schiwon 45d4c0bf66
add occ command to update UUIDs (incomplete)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 10:14:59 +07:00
Arthur Schiwon 601ce05dab
allow to re-run migration step when backup DB is already created
- to heal incomplete states from broken upgrades

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 10:14:59 +07:00
Arthur Schiwon 71fb44953e
invalidated duplicated UUIDs prior to migration change
- in a proper setup there are no duplicated UUIDs
- not all setups are proper
- log warning to admin

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 10:14:58 +07:00
Côme Chilliet 77add404b1
Remove mixed type not available in PHP 7.4
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-08 14:32:23 +07:00
Côme Chilliet 5f65d5a58d
Add a comment explaining how Helper::loginName2UserName can work
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-08 14:25:09 +07:00
Côme Chilliet 2a0b2250d2
Improve typing in OCA\User_LDAP\Access and reduce psalm errors
This should avoid some PHP warning using PHP 8.1
 and help detecting type trouble early in the future.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-08 14:21:16 +07:00
Arthur Schiwon 2bf57cbab8
fix overwriting of SUCCESS and INVALID consts
- already defined in Symfony\Component\Console\Command\Command

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-03 23:12:51 +07:00
Côme Chilliet 843b20c4e8
Remove useless indexes with duplicated names on backup table
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-13 17:21:26 +07:00
Côme Chilliet 7e4e919408
Fix user_ldap migration for long DNs support
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-13 14:06:59 +07:00
Côme Chilliet 23845755f2
Move duplicated code to a base class for group_mapping migrations
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
2022-01-13 14:06:59 +07:00
Côme Chilliet d4cabf8a84
Split dropTable and createTable in two migrations
It is not possible to drop and create the same table in one migration

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-13 14:06:58 +07:00
Côme Chilliet e64e08ecac
Fix primary key change in user_ldap migration
Use a backup table to copy the data, drop table and recreate it with
 correct primary key, then copy the data back and drop the backup table.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-13 14:06:58 +07:00
Carl Schwan aeecb72e96
Fix a few psalm issues and moved back to psalm/phar 4.18
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-12 20:03:06 +07:00
Côme Chilliet 59862f7175
Improve ldap:test-config occ command
Test a search on the base, as the settings wizard is doing.
This is to avoid the wizard saying the base is wrong and the command
 saying everything is fine.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-04 12:17:58 +07:00
John Molakvoæ c0cfd237ab
Merge pull request #30299 from nextcloud/fix/log_files 2021-12-20 17:27:05 +07:00
Carl Schwan 52760a95d9
Check if directoy is writable instead of possibly missing file
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-12-20 15:36:52 +07:00
John Molakvoæ b5ae67ac2a
Merge pull request #29329 from nextcloud/fix/noid/groups-unwarranted-members 2021-12-20 10:07:55 +07:00
Côme Chilliet 743267eba4
Fix LDAP related docblocks types
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:43:31 +07:00
Côme Chilliet f3dcbfe146
Fix PHP 8.1 support for user_ldap application
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:43:30 +07:00
Côme Chilliet 57fda4414f
Add missing copyright headers in migration steps
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-09 17:42:17 +07:00
John Molakvoæ 2e869fd215
Merge pull request #29523 from nextcloud/fix/support-ldap-long-dns 2021-12-09 17:18:43 +07:00
Joas Schilling 168c673755
Allow to log DB, redis and LDAP requests into files
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-12-01 22:33:41 +07:00
blizzz 84e47fb484
Merge pull request #29470 from nextcloud/fix/translit-php8
Avoid use of iconv to get rid of unicode
2021-11-29 11:37:19 +07:00
Julius Härtl 388fa06695
Merge pull request #29837 from nextcloud/fix/user_ldap-check-cache 2021-11-25 16:33:52 +07:00
Côme Chilliet 20dd46fcae
Merge pull request #29610 from nextcloud/fix/user_ldap-logger
Get rid of user_ldap LogWrapper and use LoggerInterface
2021-11-23 15:26:25 +07:00
Côme Chilliet 7ac895e766
Move back logger to protected in OCA\User_LDAP\User\User
It was changed to private because of a bad copy/paste.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 11:06:14 +07:00
Côme Chilliet f932766acf
Check LDAP upon user deletion instead of refusing based on cached information
This should avoid having to wait for background job to run after
 deleting a user in LDAP before being able to delete it in Nextcloud.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 10:59:13 +07:00
Côme Chilliet a35904749f
Use clearer names for variables
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:20:31 +07:00
Côme Chilliet 514324916b
Add an index for directory_uuid as well
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:20:30 +07:00
Côme Chilliet df25a6de31
Make sure that hash function returns a string
The documentation says it can return false, and even if that is highly
 unlikely for sha256, better safe than sorry.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:20:30 +07:00
Côme Chilliet 14f00208e2
Add the columns and alter the index in Version1010Date20200630192842
This is to ensure new installations do not need to go through migration
 history.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:20:30 +07:00
Côme Chilliet c4d8bd9c05
Fixes in migration step
We cannot set ldap_dn_hash column as notnull because it is empty for
 existing users before postSchemaChange is called

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:20:29 +07:00
Côme Chilliet d4c49a3a60
Put back length check to have a clear error
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:20:29 +07:00
Côme Chilliet ce5192a461
Fixed migration step for user_ldap
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:20:29 +07:00
Joas Schilling 9a1df9ddca
Fix variable names
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-11-23 09:19:50 +07:00
Côme Chilliet 31a503b387
Change column names to ldap_dn and ldap_dn_hash and add migration
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:19:50 +07:00
Côme Chilliet 662e3240b0
Support LDAP dns longer than 255 characters
Adds an ldap_full_dn column to store the dn, and only store a sha256
 hash in the ldap_dn which is shorter and can be indexed without
 trouble.
Migration still needs to be implemented.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:19:49 +07:00
Côme Chilliet 480056de88
Fix sanitizing regex and add a test case for uppercase in username
I did not find any test data that would fail with the previous regex,
 but still added data with uppercase to at least test that.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:10:38 +07:00
Côme Chilliet 3446d9c0b2
Ignore cache in occ ldap:check-ldap command
This avoids having to wait or reset the cache after deleting a user in
 the LDAP.
This also fixes a PHP error when running ldap:check-ldap --update on a
 deleted but cached user.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-22 16:44:27 +07:00
Côme Chilliet 51ea7dc020
Make sure mapping cache is cleared when deleting a user
This avoids phantom remnants staying after user deletion

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-22 14:49:34 +07:00
Arthur Schiwon 8266f88755
fix potential unwarranted memberships in nested groups from LDAP
- the issue was present only when using PHP based resolving of nested
  group members. Normally nested members are common in AD (and Samba4) and
  are resolved per LDAP_MATCHING_RULE_IN_CHAIN by default
- resolving nested members is recursive
- when the cache entry was created it happend for intermediate groups, too,
  containing members from the parent group
- the check was added to only cache the root group with its members
- a runtime cache stores intermediate ldap read results


Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-11-19 13:07:19 +07:00
Côme Chilliet 6b960de47c
Get rid of LogWrapper calling deprecated logger and use LoggerInterface from PSR instead
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-09 15:11:15 +07:00
Côme Chilliet 158e73242e
Avoid use of iconv to get rid of unicode
Using iconv for translit depends upon server configuration, locale, and
 PHP version. Using htmlentities instead to have a consistent behavior
 independent of configuration.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-28 10:30:14 +07:00
Carl Schwan a67a12cb96
Merge pull request #29240 from nextcloud/work/admin-delegation-implementation
Add support for Delegation Settings for more apps
2021-10-15 20:59:43 +07:00
Carl Schwan 719dbafd13
Add support for Delegation Settings for more apps
* This adds support for the sharing, groupware, theming and user_ldap
  app
* This adds some code who disapeared during a rebase in the initial
  delegation PR (provisioning_api)

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-10-15 18:41:00 +07:00
Côme Chilliet f9e6f2ea57
Use Psr\Log\LoggerInterface where it can easily be used in user_ldap
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-14 14:12:03 +07:00
Côme Chilliet d189a23f43
Fix two mistakes in previous migration to LoggerInterface in OCA\User_LDAP\Access
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-14 09:24:49 +07:00
Côme Chilliet 51398d706a
Use Psr\Log\LoggerInterface in OCA\User_LDAP\Access
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-12 17:19:51 +07:00
Côme Chilliet 437048e9b6
Avoid PHP errors when the LDAP attribute is not found
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-12 12:44:26 +07:00
blizzz e8f76b03bb
Merge pull request #28876 from nextcloud/fix/28653/ldap-long-user-group-ids
ensure that user and group IDs in LDAP's tables are also max 64chars
2021-09-24 22:53:06 +07:00
Arthur Schiwon 6ab30a669b
ensure that user and group IDs in LDAP's tables are also max 64chars
- limitation by core tables (e.g. sharing), IDs are always 64chars
- when longer group IDs were requested they are hashed (does not affect
  displaynames)

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-09-24 17:29:29 +07:00
Arthur Schiwon 7178194198
fix caching of objectsid searches
- store result when no name could be retrieved, too
- cached value is not an array, was treated wrongly

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-09-21 13:32:42 +07:00
Arthur Schiwon 27865d03c0
use specific email getter where necessary
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-09-09 19:23:05 +07:00
Gary Kim b78f3a57d1
Migrate HintException to OCP
Signed-off-by: Gary Kim <gary@garykim.dev>
2021-06-30 15:28:02 +07:00
Arthur Schiwon f62c066459
unset ldap provider when disabling user_ldap
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-30 15:25:00 +07:00
Arthur Schiwon bbcd8c9a68
LDAP: determine shares of offline users only when needed
- determine shares may via Sharing code result in user exists checks
- this may result in an infinite loop when user exists was called before
- the info is really only required at one occ command

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-28 12:56:37 +07:00
Christoph Wurst 39f0aa5abe
Merge pull request #27515 from nextcloud/enh/noid/read-multi-value-user-attribute
Add method to read multi-value attributes from ldap
2021-06-16 15:51:09 +07:00
Daniel Kesselberg 04411df695
Add method to read multi-value attributes from ldap.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-06-16 11:35:27 +07:00
Daniel Kesselberg 33801708d2
Add return type for writeToCache
writeToCache does not return a string.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-06-15 17:03:03 +07:00
Christoph Wurst bf564e2a5a
Convert command option defaults to strings
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-06-09 13:25:31 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Valdnet 77ca79f697
l10n: Spelling unification
Spelling unification in Transifex.

Signed-off-by: Valdnet 47037905+Valdnet@users.noreply.github.com
2021-05-21 11:50:12 +07:00
Arthur Schiwon 2a5473e146
do not try to search after the last page
- saves an LDAP requests in these cases
- prevents a Protocol Error logged on < 7.3 API (for backports)

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-04-27 12:52:26 +07:00
Arthur Schiwon 5e8f43a55e
removes PagedResults adapter for PHP < 7.3
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-04-26 22:57:42 +07:00
Roeland Jago Douma 0593b039fc Move over notification to new registration
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-04-16 13:56:28 +07:00
Morris Jobke 6a81477ffe
Merge pull request #25326 from nextcloud/ldap-factory-no-ldap
make ILDAPProviderFactory usable when there is no ldap setup
2021-03-31 21:23:23 +07:00
Robin Appelman 65b78515bd
make ILDAPProviderFactory usable when there is no ldap setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-31 15:23:33 +07:00
Johannes Leuker 9660a3fa90 Add json, yaml output options to ldap:show-config
Signed-off-by: Johannes Leuker <j.leuker@hosting.de>
2021-03-31 12:36:22 +07:00
Joas Schilling 0d46fafd41
Merge pull request #26161 from nextcloud/bugfix/noid/improve-matching-of-phonebook-searches
Improve search results when only phonebook-matches can we autocompleted
2021-03-17 15:22:03 +07:00
Arthur Schiwon 1b0355f2c6
adds ldap user:reset command
- allows to delete data of existing LDAP users, which otherwise is safe
  guarded
- ensures that the user is not being deleted on LDAP through a plugin

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-03-17 11:23:48 +07:00
Joas Schilling 3379e69ecc
Fix parameter types in docs
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-03-17 09:51:31 +07:00
Roeland Jago Douma 54cffefed4
Merge pull request #25660 from hosting-de/feature/add-backend-list-groups
Show group backends in occ group:list --info and group:info
2021-03-05 08:49:43 +07:00
blizzz ef5389603c
Merge pull request #25860 from nextcloud/fix/noid/ldap-bind-expired
do not die after LDAP auth failed with expired acc
2021-03-02 21:34:03 +07:00
Arthur Schiwon 5ad08c7c84
do not die after LDAP auth failed with expired acc
- some servers return error code 53

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-03-01 19:20:05 +07:00
Johannes Leuker 2796ef80ff Show group backends in occ group:list --info and group:info
Signed-off-by: Johannes Leuker <j.leuker@hosting.de>
2021-03-01 16:02:08 +07:00
Arthur Schiwon 4d33449faa
fix detecting cyclic group memberships
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-02-23 22:50:43 +07:00
dependabot-preview[bot] eb502c02ff
Bump nextcloud/coding-standard from 0.3.0 to 0.5.0
Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/nextcloud/coding-standard/releases)
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nextcloud/coding-standard/compare/v0.3.0...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-02-18 13:31:24 +07:00
Roeland Jago Douma 3f4ece256e Some psalm OfflineUser fixes
For #25641

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-02-15 13:36:02 +07:00
Christoph Wurst 6a3321cefe
Merge pull request #25101 from nextcloud/fix/noid/ldap-known-groups
LDAP: make actually use of batch read known groups
2021-01-29 10:57:31 +07:00
Arthur Schiwon 90d82b03ef
fix parameter provided as string not array
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-28 15:15:55 +07:00
blizzz 939433363e
Merge pull request #25128 from nextcloud/ldapprovider-get-property
extend ILDAPProvider to allow reading arbitrairy ldap attributes for users
2021-01-22 14:31:19 +07:00
Arthur Schiwon ef0a3a92f4
silence log message
- this appears too often (in some configurations) when qualifying group
members which do not meet the criteria

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-21 17:25:44 +07:00
Robin Appelman fdc8635afb
extend ILDAPProvider to allow reading arbitrairy ldap attributes for users
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-01-19 16:33:58 +07:00
blizzz f9ab7575e7
Merge pull request #25036 from nextcloud/fix/noid/limitied-allowed-items-db-in_2
respect DB restrictions on number of arguments in statements and queries
2021-01-14 11:36:42 +07:00
Arthur Schiwon 21ca5d4514
silence psalm false positive
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-13 11:54:29 +07:00
Arthur Schiwon 02b703193a
really use known groups
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-12 20:52:52 +07:00
Christoph Wurst c1d4f8161b
Migrate internal classes to the OCP db col types
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-01-12 14:09:13 +07:00
Arthur Schiwon 45e3261ad5
respect DB limits limit per statement and query
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-11 13:43:34 +07:00
Christoph Wurst 8b64e92b92
Bump doctrine/dbal from 2.12.0 to 3.0.0
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-01-08 11:45:19 +07:00
Roeland Jago Douma dc89447f13
Revert "(LDAP) respect DB limits of arguments in an IN statement" 2021-01-08 10:44:32 +07:00
Arthur Schiwon 6eca8d6ae1
respect DB limits of arguments in a IN list
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-07 20:16:40 +07:00
Christoph Wurst 9ce3ea3368
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-30 14:07:05 +07:00
Roeland Jago Douma adc4f1a811
Merge pull request #22916 from J0WI/unifiy-links-to-php.net
Unify links to php.net
2020-12-22 09:53:31 +07:00
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +07:00
blizzz f68cab4e39
Merge pull request #24402 from nextcloud/fix/24252/ldap-ingroup-memberid
LDAP: fix inGroup for memberUid type of group memberships
2020-12-15 22:33:41 +07:00
Arthur Schiwon 270912848f
check number of members after potential resolving of rdns
- the type check is not necessary anymore for the return type of
  _groupMembers()

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-11-27 18:44:27 +07:00
Arthur Schiwon 1f40ecca86
use faster and less hungry foreach
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-11-27 18:38:08 +07:00
Christoph Wurst 334f3943ab
Migrate LDAP's install.php to a repair step
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-11-27 15:13:01 +07:00
Tobias Perschon 594370e2f2 moved the array_reduce to fix large search case
also added some additional comments and renamed some vars to make it intuitive whats in them

Signed-off-by: Tobias Perschon <tobias@perschon.at>
2020-11-27 11:12:14 +07:00
Arthur Schiwon 57bfe0d1f9
flatten result array as expected by following code
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-11-26 23:36:04 +07:00
Joas Schilling 8027dcbc6f
Don't leave cursors open when tests fail
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-09 12:28:17 +07:00
Arthur Schiwon c96a9a9001
fix insert values
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-11-06 13:30:19 +07:00
Arthur Schiwon 4104416e81
only delete specified config
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-11-06 13:01:37 +07:00
Joas Schilling 8547934e20
Correctly place the array type 2020-11-06 12:09:58 +07:00
Joas Schilling c5b6e4bc09
Use query builder to interact with member management
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-06 11:28:53 +07:00
Joas Schilling 5fba0e562f
Use query builder instead of OC_DB in user_ldap
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-06 11:25:28 +07:00
Arthur Schiwon 3a51160221
fix potentially passing null to events where IUser is expected
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-30 16:30:01 +07:00
Arthur Schiwon fd44087530
adds unit test for updategroups background job
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-30 16:30:00 +07:00
Morris Jobke 0053ec82ac
Document the backend registered events of LDAP
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-10-29 09:18:46 +07:00
Arthur Schiwon fd1fd5afa4
user share manager to determine share ownership
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-26 16:05:28 +07:00
Arthur Schiwon 951887e922
fixes determining whether former user is a share owner
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-26 16:05:28 +07:00
Arthur Schiwon 2e455f632a
split instantiation from business logic in OfflineUser
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-26 16:05:28 +07:00
Arthur Schiwon 86e5e7d927
LDAP simplify User_Proxy and Group_Proxy signatures
- make User_Proxy and Group_Proxy easy to instantiate
- simplify dependent code
- move commands to info.xml
- make UpdateGroups job class non-static

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-23 12:25:31 +07:00
Arthur Schiwon 2ee26b691c
tame psalm. why does it ignore '@property'?
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-19 13:44:32 +07:00
Arthur Schiwon d741c5ab30
when nesting is not enabled, the group filter can be applied right away
- helps performance, but skipping unnecessary entries
- reduces reoccuring info-level log output against groups that do not
  qualify ("no or empty name")

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-19 13:44:32 +07:00
Christoph Wurst d9015a8c94
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-10-05 20:25:24 +07:00
J0WI 68ce17e59b Unify links to php.net
Update all links to https://www.php.net/

Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2020-09-17 17:40:04 +07:00
Arthur Schiwon b95e63b8da
announce added user and group backend later as there might be interdeps
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-09-11 00:14:06 +07:00
Arthur Schiwon 263f5bd1d9
switch to typed event for LDAPs user added to group case
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-09-10 12:57:10 +07:00
Christoph Wurst 1f7f93a695
Update license headers for Nextcloud 20 (again)
There are still lots of outdated headers, so time for another round of
updates.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-09-07 14:37:44 +07:00
Arthur Schiwon aa2d754d5c
add repair step to clean up DB off lastFeatureRefresh entries in user prefs
- also removes related app setting "updateAttributesInterval"

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-09-04 12:59:57 +07:00
Arthur Schiwon 699871dcb0
these code bits were part of old logic that was already refactored out
- only references were in unit tests

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-09-04 12:56:43 +07:00
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +07:00
Morris Jobke fedf9c69d9
Use matching parameter names form interfaces and implementations
Found by Psalm 3.14.1

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-19 18:16:35 +07:00
Arthur Schiwon 44cad1756c
provide event class to LDAP loaded event to fix deprecation message
* and also dispatch the typed event as current approach to it

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-08-12 15:38:47 +07:00
Arthur Schiwon 5257efc5f2
remove logging message carrying no valuable information
the exception caught is not an error, but due to valid configuration and
code flow is expecting this. For an admin it is confusing, and it carries
no information worth for debugging.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-08-12 09:10:23 +07:00
Arthur Schiwon 7eb6d8df0a
do not flip available state to unavailable, allow empty results
- the detection relies that the first, requested result is not empty
- it might be empty though – groups without members
- protect switching from available to unavailable
  - switching the other way around was also not envisaged either

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-08-11 19:03:27 +07:00
Arthur Schiwon 7ea262dba0
LDAP: shortcut in reading nested group members when IN_CHAIN is available
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-08-11 18:22:11 +07:00
Morris Jobke 548576ec10
Merge pull request #22176 from nextcloud/debt/noid/table-render-too-many-arguments
Remove unexpected argument
2020-08-11 09:44:28 +07:00
Daniel Kesselberg 7b68f0f326
Remove unexpected argument
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-08-10 22:36:30 +07:00
Arthur Schiwon 7c07f0c7f3
use break not continue in switch to avoid warning
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-08-10 17:34:11 +07:00
blizzz 579c7073f3
Merge pull request #16737 from tofuSCHNITZEL/feature-zimbraldap
new Group-Member association attribute (zimbraMailForwardingAddress)
2020-08-07 22:20:50 +07:00
Tobias Perschon 551d904bb0
added "zimbraMailForwardingAddress" as a Group-Member association attribute to enable the use of Zimbra Distribution Lists as groups in nextcloud when connecting to a zimbra LDAP
Signed-off-by: Tobias Perschon <tobias@perschon.at>

fix cs:check

Signed-off-by: Tobias Perschon <tobias@perschon.at>

Update apps/user_ldap/lib/Group_LDAP.php

Co-authored-by: blizzz <blizzz@arthur-schiwon.de>
Signed-off-by: Tobias Perschon <tobias@perschon.at>
2020-08-07 23:30:44 +07:00
Morris Jobke 54726d5934
Merge pull request #21738 from nextcloud/techdebt/14552/migrate-OC_Group-post_removeFromGroup
Migrate OC_Group post_removeFromGroup hook to actual event object
2020-08-07 17:46:00 +07:00
Morris Jobke 36ee37ec0a
Migrate OC_Group post_removeFromGroup hook to actual event object
Ref #14552

This adds a BeforeUserRemovedEvent to the LDAP backend because it was missing. It's not really before, but we don't have the before state.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-30 10:21:08 +07:00
Arthur Schiwon d3501be851
reset the cookie internally in new API when abandoning paged results op
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-07-29 17:48:56 +07:00
Morris Jobke 7870ca0663
Use the proper IAppContainer and IServerContainer type hints to know which code runs with which container
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-21 20:44:05 +07:00
Christoph Wurst 91e7f12088
Adjust apps' code to use the ContainerInterface
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-07-21 20:43:18 +07:00
Christoph Wurst 35e966c38d
Migrate LDAP to the PSR container
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-07-16 15:57:17 +07:00
Morris Jobke f42e557fa1
Use IBootstrap for the app user_ldap
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-14 04:47:54 +07:00
Morris Jobke 3203286f52
Do not use custom DI object names for user_ldap
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-13 17:22:19 +07:00
Morris Jobke 7ad0381e5c
Merge pull request #21639 from nextcloud/techdebt/noid/move-away-from-database-xml
Move away from database xml
2020-07-06 22:42:39 +07:00
Joas Schilling 556e23e681
Move user_ldap to migrations
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-07-06 16:42:14 +07:00
Morris Jobke d72d9ff1f4
Merge pull request #21171 from nextcloud/enh/noid/tidy-up-group-ldap
tidy up Group_LDAP
2020-07-06 14:00:27 +07:00
Joas Schilling d7c0b9cced
Also always return in app commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-06-26 15:12:11 +07:00
Arthur Schiwon b8bef4ded0
fix strings being passed where arrays where expected
also brought type hints up to internal API level

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-06-24 23:34:37 +07:00
Arthur Schiwon 3baa8d22a6
comment was wrong, block is needed nevertheless
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-06-24 17:51:11 +07:00
blizzz 0ab6ee40de
be more clear about the condition
Co-authored-by: Christoph Wurst <ChristophWurst@users.noreply.github.com>
2020-06-16 10:55:51 +07:00
Arthur Schiwon 0cf57d1ed4
getXbyY can still return false, e.g. when using ldap write support
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-06-15 21:48:27 +07:00
Arthur Schiwon 4edf8630c4
clear LDAP cache after user deletion
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-06-08 17:52:43 +07:00
Arthur Schiwon 64fe042b0d
tidy up Group_LDAP
* remove unused method
* resolve code duplication
* remove usage of deprectad Util::writeLog
* phpDoc updates
* signature updates

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-06-08 13:40:24 +07:00
Arthur Schiwon aed6f0f71e
simplify getGroups, fixing wrong chunking logic
pagination is taken care of properly in the search logic in Access class

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-05-27 14:41:10 +07:00
Arthur Schiwon 15008a1798
fixes infinitely repeating LDPA search results with PHP <= 7.2
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-05-26 00:37:46 +07:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +07:00
Clement Wong 9f5f505acf Don't remove last user in ldap group when limit is -1
Signed-off-by: Clement Wong <git@clement.hk>
2020-04-27 02:33:00 +07:00
blizzz 212138daa1
Merge pull request #19919 from nextcloud/enh/noid/ldpa_group_perf
LDAP Group Backend optimizations
2020-04-24 12:27:27 +07:00
Arthur Schiwon 4babdc082b
formatting
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-04-23 21:34:05 +07:00
Arthur Schiwon 75c686d825
do not run paged results against ldap_read ops on PHP7.3+
- previously it was needed as the PHP LDAP handling of paged results was
strange
- but now the read operation would fail, e.g. with extra home dir attribute
set ("Home dir attribute can't be read from LDAP for uid: foobar"

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-04-21 15:47:49 +07:00
Arthur Schiwon ab550d682f
do not rerun expensive sanitizer against already processed DNs
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-04-17 12:49:47 +07:00
Arthur Schiwon 32000dd1af
read records from DB for lists at once, not one by one.
Keep a runtime cache of dn-id-mapping

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-04-17 12:39:54 +07:00
Arthur Schiwon cc31c38277
don't circulate with only one backend
- saves some overhead costs
- in some occasions saves LDAP requests

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-04-17 12:38:52 +07:00
Arthur Schiwon e8ddb4718c
consolidate groupsMatchFilter in groupsExist
- less duplication
- profiting of the same cache entry

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-04-17 12:38:07 +07:00
Roeland Jago Douma d9990b09b8
PHP-CS-Fixer green
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-04-16 09:25:17 +07:00
Arthur Schiwon 84619a5b9c
use serverControls directly with LDAP calls, fixes 19127
- adapters for PHP API version to Support PHP < 7.3
- switch to pass only one base per search
- cookie logic is moved from Access to API adapters

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-04-14 12:58:28 +07:00
Christoph Wurst 734c62bee0
Format code according to PSR2
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:56:50 +07:00
Christoph Wurst 28f8eb5dba
Add visibility to all constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:54:27 +07:00
Christoph Wurst 1584c9ae9c
Add visibility to all methods and position of static keyword
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:51:06 +07:00
Christoph Wurst a7c8d26d31
Add visibility to all properties and move static keyword
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:48:31 +07:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
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>
2020-04-10 14:19:56 +07:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +07:00
Christoph Wurst 008e6d7e84
Merge pull request #20391 from nextcloud/refactor/spaces-cleanup
Remove all extra whitespace PSR2 does not like
2020-04-09 20:39:37 +07:00
Christoph Wurst 64510932b8
Merge pull request #20384 from nextcloud/techdebt/lowercase-keywords
Use php keywords in lowercase
2020-04-09 16:25:14 +07:00
Christoph Wurst a8a06a82d2
Remove trailing whitespaces from comments
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 16:09:23 +07:00
Christoph Wurst 44577e4345
Remove trailing and in between spaces
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 16:07:47 +07:00
Christoph Wurst 36b3bc8148
Use php keywords in lowercase
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 14:04:56 +07:00
Christoph Wurst afbd9c4e6e
Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 13:54:22 +07:00
Christoph Wurst 41b5e5923a
Use exactly one empty line after the namespace declaration
For PSR2

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 11:48:10 +07:00
Christoph Wurst 2fbad1ed72
Fix (array) indent style to always use one tab
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 10:16:08 +07:00
Christoph Wurst 85e369cddb
Fix multiline comments
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-08 22:24:54 +07:00
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-31 14:52:54 +07:00
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +07:00
Philipp Staiger 8769d97f62 single squashed commit for bug fix
Signed-off-by: Philipp Staiger <philipp@staiger.it>
2020-03-26 09:01:35 +07:00
Arthur Schiwon 77c63e3b24
fixes auto-detecting UUID attributes
the continue (and later the early return) avoided proper looping over the
attribute candidates.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-03-19 19:42:46 +07:00
Arthur Schiwon 407b8fddfc
remove noise from detectUuid and cache results
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-02-19 16:42:36 +07:00
Arthur Schiwon a0e57ea6d3
sort prefixes for deterministic LDAP query behaviour
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-02-07 18:10:31 +07:00