Commit graph

940 commits

Author SHA1 Message Date
Côme Chilliet
e502220693 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>
2022-02-21 15:48:07 +00:00
Côme Chilliet
6201d4c157 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>
2022-02-21 15:48:07 +00:00
Côme Chilliet
a1d6678c25 Fix psalm errors in apps/user_ldap/lib/Jobs/CleanUp.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-10 18:48:33 +00:00
Côme Chilliet
ef11c61f19 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 18:48:33 +00:00
Arthur Schiwon
91578d0e5a add occ command to update UUIDs (incomplete)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 18:48:33 +00:00
Arthur Schiwon
0931853023 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 18:48:33 +00:00
Arthur Schiwon
ac68b0662a 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 18:48:32 +00:00
Carl Schwan
57514e44a9
Psalm fixing
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-27 17:20:48 +01:00
Côme Chilliet
089377bd0d Remove useless indexes with duplicated names on backup table
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:40:56 +00:00
Côme Chilliet
488e17cd44 Fix user_ldap migration for long DNs support
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:40:54 +00:00
Côme Chilliet
9a13fb0b0e 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-14 08:40:54 +00:00
Côme Chilliet
3d3bbf92aa 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-14 08:40:53 +00:00
Côme Chilliet
58cd5eb2e1 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-14 08:40:52 +00:00
Louis
7f82061ab9
Merge pull request #30340 from nextcloud/backport/29329/stable22
[stable22] fix potential unwarranted memberships in nested groups from LDAP
2021-12-30 11:03:03 +01:00
Côme Chilliet
c891fffde8 [stable23] 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>
Co-authored-by: MichaIng <micha@dietpi.com>
2021-12-20 09:57:43 +00:00
Arthur Schiwon
ad0ea2ccb0 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-12-20 09:10:49 +00:00
Côme Chilliet
1523482047
Add missing copyright headers in migration steps
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:36 +01:00
Côme Chilliet
30507846bc
Use clearer names for variables
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:36 +01:00
Côme Chilliet
ddb9727be1
Add an index for directory_uuid as well
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:35 +01:00
Côme Chilliet
bab9964c01
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-12-16 09:05:35 +01:00
Côme Chilliet
bae8799e80
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-12-16 09:05:35 +01:00
Côme Chilliet
aa65a4fe90
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-12-16 09:05:34 +01:00
Côme Chilliet
581b1d8da6
Put back length check to have a clear error
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:34 +01:00
Côme Chilliet
343989aa52
Fixed migration step for user_ldap
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:33 +01:00
Joas Schilling
3ba2afbcdf
Fix variable names
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-12-16 09:05:33 +01:00
Côme Chilliet
072897cdf8
Change column names to ldap_dn and ldap_dn_hash and add migration
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:33 +01:00
Côme Chilliet
0843dda1bd
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-12-16 09:05:16 +01:00
Côme Chilliet
5b2764a2aa 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-23 10:23:10 +00:00
Côme Chilliet
9f27bde82b 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-19 09:25:13 +00:00
Côme Chilliet
6372c34c40 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-19 09:25:13 +00:00
Côme Chilliet
d29a132949 Use Psr\Log\LoggerInterface in OCA\User_LDAP\Access
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-19 09:25:13 +00:00
Côme Chilliet
206d6d034f Avoid PHP errors when the LDAP attribute is not found
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-19 09:25:12 +00:00
Arthur Schiwon
8586d6040d
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-29 14:17:13 +02:00
Arthur Schiwon
14fa79f37a 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-24 15:07:03 +00:00
Arthur Schiwon
0571d41df5
use specific email getter where necessary
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-09-10 13:22:27 +02:00
Arthur Schiwon
87d8e8f6d3 unset ldap provider when disabling user_ldap
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-30 16:52:09 +00:00
Arthur Schiwon
b299369c15 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 17:15:51 +00: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 +02: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 +02: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 +02: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 +02:00
John Molakvoæ (skjnldsv)
215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +01:00