Commit Graph

966 Commits (302a67f6853065122ef8648cdbdefc1504e8d350)

Author SHA1 Message Date
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