Commit Graph

89 Commits (8904bf645b30fbdfdcb00a2ea607d752ee69d865)

Author SHA1 Message Date
Arthur Schiwon d6b356c63b enh(LDAP): implement IIsAdmin interface
- add configuration to specify one LDAP group acting as admin group (CLI)
- implement `isAdmin()` method, basically relying on inGroup against the
  configured group

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-12-01 12:48:24 +07:00
Arthur Schiwon cb3faad5b5
fix(ldap): store last known user groups
- for LDAP user life cycle management

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-10-09 19:46:27 +07:00
Côme Chilliet b2f01b72fe
Merge pull request #34443 from nextcloud/feat/add-enabled-user-backend
Add IProvideEnabledStateBackend interface
2023-07-03 10:19:32 +07:00
Faraz Samapoor b0938b9083 Refactors "strpos" calls in /apps/user_ldap to improve code readability.
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
2023-06-02 15:26:55 +07:00
Côme Chilliet 50ccfb4f5b
[user_ldap] Add per-connection setting for marking remnants as disabled
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-23 16:03:17 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
Côme Chilliet f7cd7047a2
Merge pull request #24574 from zenlord/ldapi-unix-socket-support
Ldapi unix socket support
2022-12-08 17:25:00 +07:00
blizzz b16c9838c6
Merge pull request #35355 from nextcloud/artonge/feat/ldap_connection_timeout
Allow to set a custom timeout for ldap connections
2022-11-30 14:44:15 +07:00
Louis Chemineau a781ae3afb Allow to set a custom timeout for ldap connections
Signed-off-by: Louis Chemineau <louis@chmn.me>
2022-11-23 11:37:49 +07:00
Côme Chilliet 90165309e1
Improve a bit codestyle
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-11-22 16:57:24 +07:00
Côme Chilliet 4893501abe
Log as warning instead of info when main LDAP server is unreachable
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-11-21 10:31:24 +07:00
Côme Chilliet 3e15ea6cd0
Log switching to LDAP backup host because main one is not available
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-11-17 14:58:44 +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
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
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 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
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 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
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
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +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
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 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
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
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 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
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 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 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 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
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +07:00
Arthur Schiwon 38a8306e32
treat LDAP error 50 as auth issue, prevents lost server connection errors
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-10-18 18:55:10 +07:00
Arthur Schiwon c6c8a41d2f
group display name support (service level + ldap)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-05-27 12:03:05 +07:00
Arthur Schiwon 5dd2207c95
fix nested group retrieval also for 2 other cases
and also consolidate logic in one method

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-03-05 11:07:40 +07:00
Arthur Schiwon 792bcb82ae
add LDAP ConfigHandler for external storages and "$home" var
* handler registered upon OCA\\Files_External::loadAdditionalBackends
  event as user_ldap is loaded before files_external
* new configuration field "ldapExtStorageHomeAttribute" (not in GUI yet)

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-02-14 15:22:22 +07:00
Arthur Schiwon 2048872f9e
functions that were checked for are present since PHP 5.4, supported is >=/
* so the check from older days is really not necessary anymore
* resolves #10923

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-10-25 22:50:42 +07:00
Julius Härtl c2616df541
Only bind if configuration for the first server is available
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-07-13 08:25:10 +07:00
Arthur Schiwon 343036e55c
allow admin to disable fetching of avatars as well as a specific attribute
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-07-05 11:12:51 +07:00