Commit Graph

836 Commits

Author SHA1 Message Date
Arthur Schiwon 6a3b483273 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 17:43:44 +00:00
Arthur Schiwon 7afb588059
fix detecting cyclic group memberships
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-03-03 10:53:24 +01:00
Arthur Schiwon 4b3961c412 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-02 20:40:11 +00:00
Arthur Schiwon 654a41e313
really use known groups
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-02-17 14:05:13 +01:00
Arthur Schiwon 9fc88bd217 fix parameter provided as string not array
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-28 19:42:41 +00:00
blizzz a4c7a62394
Merge pull request #25121 from nextcloud/backport/25036/stable19
[stable19] respect DB restrictions on number of arguments in statements and queries
2021-01-28 12:27:52 +01:00
Arthur Schiwon a6dd38b718 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 21:12:22 +00:00
Arthur Schiwon b4d83c6f02
silence psalm false positive
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-15 00:53:42 +01:00
Arthur Schiwon e57d8d6521
respect DB limits limit per statement and query
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-15 00:53:22 +01:00
Arthur Schiwon e23af8307c
fix potentially passing null to events where IUser is expected
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-11-04 12:16:34 +01:00
Arthur Schiwon 9c5bd23cf7 fixes determining whether former user is a share owner
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-27 08:49:04 +00:00
Arthur Schiwon 7544f0c508 split instantiation from business logic in OfflineUser
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-27 08:49:02 +00:00
Arthur Schiwon 59974c1fd5
tame psalm. why does it ignore '@property'?
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-21 16:26:48 +02:00
Arthur Schiwon 85d5ac5c91
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-21 16:26:47 +02:00
Arthur Schiwon 51fa743c7a
makes LDAP's group updater dispatch type events
* fixes group share updates on added users

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-09-10 15:18:47 +02:00
Arthur Schiwon 8b291adb08
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-07 10:50:17 +02:00
Arthur Schiwon 303bac6c75 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-06 17:57:08 +00:00
blizzz 33db8a97c9
Merge pull request #22203 from nextcloud/backport/21559/stable19
[stable19] shortcut in reading nested group members when IN_CHAIN is available
2020-08-12 13:42:08 +00:00
Arthur Schiwon f32b1e4856 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:18:39 +00:00
Arthur Schiwon ebb565f7a8
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-12 00:34:15 +02:00
Arthur Schiwon 74bde3eb49 LDAP: shortcut in reading nested group members when IN_CHAIN is available
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-08-11 22:24:38 +00:00
Daniel Kesselberg 778e5afcc5 Remove unexpected argument
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-08-11 07:47:32 +00:00
Arthur Schiwon b791ea755d reset the cookie internally in new API when abandoning paged results op
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-07-31 08:19:23 +00:00
Arthur Schiwon 43b8b0c14f 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-25 08:06:29 +00:00
Arthur Schiwon 2a3ebe4353 comment was wrong, block is needed nevertheless
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-06-24 19:07:38 +00:00
blizzz 8e02367453 be more clear about the condition
Co-authored-by: Christoph Wurst <ChristophWurst@users.noreply.github.com>
2020-06-19 18:03:07 +00:00
Arthur Schiwon 6f49974851 getXbyY can still return false, e.g. when using ldap write support
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-06-19 18:03:07 +00:00
Arthur Schiwon 5b63593956 clear LDAP cache after user deletion
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-06-09 08:23:42 +00:00
Arthur Schiwon 1e5295138a 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 17:38:45 +00:00
Arthur Schiwon d0559a4871 fixes infinitely repeating LDPA search results with PHP <= 7.2
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-05-26 09:56:10 +00:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +02: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 +02:00
blizzz 212138daa1
Merge pull request #19919 from nextcloud/enh/noid/ldpa_group_perf
LDAP Group Backend optimizations
2020-04-24 12:27:27 +02:00
Arthur Schiwon 4babdc082b
formatting
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-04-23 21:34:05 +02: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 +02: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 +02: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 +02: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 +02: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 +02:00
Roeland Jago Douma d9990b09b8
PHP-CS-Fixer green
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-04-16 09:25:17 +02: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 +02:00
Christoph Wurst 734c62bee0
Format code according to PSR2
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:56:50 +02:00
Christoph Wurst 28f8eb5dba
Add visibility to all constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:54:27 +02: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 +02: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 +02: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 +02: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 +02: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 +02:00
Christoph Wurst 64510932b8
Merge pull request #20384 from nextcloud/techdebt/lowercase-keywords
Use php keywords in lowercase
2020-04-09 16:25:14 +02:00
Christoph Wurst a8a06a82d2
Remove trailing whitespaces from comments
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 16:09:23 +02:00