Commit Graph

1117 Commits

Author SHA1 Message Date
Côme Chilliet
c995428431
Merge pull request #37903 from nextcloud/fix/user_ldap-fix-multiple-ldap-support
Fix multiple LDAP configuration support by fixing AccessFactory
2023-05-02 17:11:01 +02:00
Côme Chilliet
b6c17c6ce7
Clear up return types
usersInGroup index by int for BC, searchInGroup index by uid (string).

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-27 12:00:45 +02:00
Côme Chilliet
6385a5af36
Let OC\Group\Group handle the fallback and remove default implementation from ABackend
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-27 12:00:43 +02:00
Carl Schwan
35dc223500
Optimize retrieving display name when searching for users in a group
This is recurrent scenario that we are searching for users and then for
each users we fetch the displayName. This is inefficient, so instead try
to do one query to fetch everything (e.g. Database backend) or use the
already existing DisplayNameCache helper.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2023-04-27 11:57:45 +02:00
Côme Chilliet
967955358c
Add comment about Manager instance not being shared
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-27 11:21:53 +02:00
Daniel
2abefff289
Merge pull request #36784 from nextcloud/fix/user_ldap-update-groups-fail-get
Properly test and log when a group is not found
2023-04-24 16:26:30 +02:00
Côme Chilliet
429db14a00
Fix multiple LDAP configuration support by fixing AccessFactory
It must not reuse the same OCA\User_LDAP\User\Manager instance for
 several Access instances.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-24 16:03:40 +02:00
Marc Hefter
621c6c3c56
code styling
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Marc Hefter <marchefter@march42.net>
2023-04-24 10:21:45 +02:00
Marc Hefter
aa210365ec
Update apps/user_ldap/lib/User/User.php
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Marc Hefter <marchefter@march42.net>
2023-04-24 10:14:17 +02:00
Marc Hefter
e83520617d
removed profile data from LDAP will get removed
If attribute mapping is configured and no value present in LDAP, the
according profile field is emptied. Removing an attribute e.g. phone
from LDAP will cause the phone number being removed from profile.

Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-21 10:35:44 +02:00
Simon L
93966e99c1
Merge pull request #36565 from march42/feature/ldap_update_profile
[user_ldap] Update profile from LDAP fields
2023-04-20 11:23:24 +02:00
Marc Hefter
64914593a0
optimized handling of user profile data change
Check profile data checksum before updating user profile, to ensure
data has changed. Write checksum to user settings and cache.

Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-14 11:08:46 +02:00
Julien Veyssier
f3cd559c54 perform exact Ldap search as well to make sure it works for attributes without a substr matching rule
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
2023-04-13 19:59:17 +00:00
Marc Hefter
eec5e702da
error handling in update profile from LDAP
added error message on InvalidArgumentException

Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-11 16:40:00 +02:00
Marc Hefter
ebb0c53f9e
trying to make github-code-scanning bot happy
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:31 +02:00
Marc Hefter
72d0a3f26e
added simple data conversion for LDAP attributes
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:31 +02:00
Marc Hefter
1e7bc93ec8
handling, formatting of postalAddress attribute syntax
replace '$' with ', ' delimiter for address property
reformatted some code to 80 column
early check and return, if wasRefreshed('profile')
removed FIXMEs after digging and double checking

Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:30 +02:00
Marc Hefter
5ea46d81bb
nice up the code handling AccountManager
merging defaultScopes from DEFAULT_SCOPES and account_manager.default_property_scope
removing unneccessary profileScope setting (using config.php instead)
honoring admin choice 'profile.enabled'=>false in config.php
moved checking for empty array to updateProfile function
corrected some typos and cleaned some comments

Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:30 +02:00
Marc Hefter
dd2bd6a925
refined code, to be independend from OCP\IUser
rework updateProfile in user_ldap/lib/User/User.php
some cleanup at processAttributes in user_ldap/lib/User/User.php
rearranged Fediverse attribute, to match profile layout

Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:29 +02:00
Marc Hefter
c6408587ed
fixing Psalm messages
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:28 +02:00
Marc Hefter
f812b87576
handling updateProfile with array of values
using an array to buffer profile updates, like suggested by @come-nc
clean some code and remove unneccessary redundancy
added the Fediverse profile property

Co-Authored-By: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:28 +02:00
Marc Hefter
5c4a05cfd6
CleanUp: removed redundant storing profile attributes in user settings
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:27 +02:00
Marc Hefter
3020290751
CleanUp: removed redundant condition if block
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:27 +02:00
Marc Hefter
2f76b7a3d5
CleanUp: tidy checking for empty profileScope
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:26 +02:00
Marc Hefter
44065c0fea
Fix: Parameter $scope has no provided type
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Marc Hefter <marchefter@march42.net>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:25 +02:00
Marc Hefter
26aa1c3580
CleanUp: remove unneeded UNSET, to unclutter code
Signed-off-by: march42 <marchefter@gmail.com>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:25 +02:00
Marc Hefter
240c57b94b
cleanup: removed unnecessary imports of IAccountManager, AccountManager, IDBConnection
Signed-off-by: Marc Hefter <marchefter@march42.net>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:24 +02:00
Marc Hefter
b72fbd58f6
fixed error: Array to string conversion at user_ldap/lib/User/User.php#639
Signed-off-by: Marc Hefter <marchefter@march42.net>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:23 +02:00
Marc Hefter
c7623c7869
bugfix: changed forgotten userName, to getUsername
Signed-off-by: Marc Hefter <marchefter@march42.net>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:22 +02:00
Marc Hefter
eee0275dc5
added user profile scope setting
Signed-off-by: Marc Hefter <marchefter@march42.net>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:22 +02:00
Marc Hefter
2315c17726
feature addition: [user_ldap] update user profile from LDAP
Signed-off-by: Marc Hefter <marchefter@march42.net>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:21 +02:00
Marc Hefter
7fa3c674de
feature addition: [user_ldap] update user profile from LDAP; WIP; fixing some uggly copy-and-paste errors; testing functionality; preparing and editing the documentation
Signed-off-by: Marc Hefter <marchefter@march42.net>
Signed-off-by: Marc Hefter <marchefter@gmail.com>
2023-04-06 08:20:20 +02:00
Marc Hefter
404d26aa4a
feature addition: [user_ldap] update user profile from LDAP; WIP work-in-progress; TODO update profile
Signed-off-by: Marc Hefter <marchefter@march42.net>
2023-04-06 08:19:39 +02:00
Arthur Schiwon
bd0f374cfd
Merge pull request #37575 from nextcloud/fix/user_ldap-log-suffix-names
Log a warning when a user or group is mapped with a suffix
2023-04-05 10:28:23 +02:00
jld3103
d9f8522003
Fix types for reading and writing config values
Signed-off-by: jld3103 <jld3103yt@gmail.com>
2023-04-05 09:08:56 +02:00
Côme Chilliet
51705da7a4
Log a warning when a user or group is mapped with a suffix
Most of the time, this is the result of a misconfiguration by the admin
 and is not what is expected.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-04 14:08:24 +02:00
Arthur Schiwon
17afaa488f
fix undefined method getExtStorageHome()
- adds a type check
- defines missing method in OfflineUser

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-03-22 13:54:27 +01:00
Arthur Schiwon
8f59ff880f
Merge pull request #37006 from nextcloud/ldap-unmark-dh
also unmark deleted ldap user when checking the ldap entry
2023-03-20 16:15:03 +01:00
Côme Chilliet
d82d6df646
Do not send a pagination control with size = 0 if cookie is empty
It only makes sense to send a pagination control with size 0 with a
 cookie to abandon a paged search.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-03-13 16:05:41 +01:00
Robin Appelman
3a9597fd1b
also unmark deleted ldap user when checking the ldap entry
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-03-02 16:22:17 +01:00
Côme Chilliet
0186194ae9
Properly test and log when a group is not found
Avoid an error about passing null instead of IGroup to the event
 constructor, instead skip the failed group and log the problem.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-02-20 17:34:53 +01:00
Côme Chilliet
3c0b1bdc30
Remove redundant cast to string in user_ldap
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-02 15:11:13 +01:00
Côme Chilliet
a372564850
Fix psalm spotted errors with new requirements
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-02 15:02:28 +01:00
Vincent Petry
13d5426893
Merge pull request #35839 from nextcloud/feat/user_ldap-longer-ttl-for-fallback
Apply a longer TTL of 15min to falling back on backup server
2022-12-20 17:19:56 +01:00
Côme Chilliet
f6ff717b56
Merge pull request #34772 from nextcloud/fix/clean-ldap-access-factory-usage
Make sure to use AccessFactory to create Access instances and use DI
2022-12-20 16:48:07 +01:00
Côme Chilliet
1ac2c74830
Apply a longer TTL of 15min to falling back on backup server
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-20 12:01:25 +01:00
Côme Chilliet
6b7ffcd6a8
Fixed backup host logic
Now forcing backup host applies to both main and background.
And background will fallback to backup if not responding.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-19 14:15:48 +01:00
Côme Chilliet
406750552e
Make code clearer for background host
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-19 14:15:48 +01:00
Côme Chilliet
4758bdc476
Use a dedicated LDAP host and port for background jobs if configured
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-19 14:15:46 +01:00
Côme Chilliet
75e369d306
Merge pull request #35231 from nextcloud/fix/user_ldap-cache-fetched-list-of-groups
Cache the fetched list of groups
2022-12-19 12:34:05 +01:00