3909 Commits

Author SHA1 Message Date
Andrew Ruthven
146ab4d068 Update test results for database creation.
I've rebased onto master which has a new DB version.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
56d7d22d86 Rename mapping_field to user_mapping_field
This is to be consistent with group_mapping_field. The code is backwards
compatible with mapping_field.

In sync_LDAP_groups assign user_mapping once, not for every group.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
3d28433b5b Fix the comments 2024-02-17 02:25:25 +00:00
Andrew Ruthven
9d40ae1aa7 Simplify the code by assigning the array after we've cleaned it up.
This allows shorter lines which means easier to understand code.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
2a30a9646c Have some sane defaults for LDAP group mappings 2024-02-17 02:25:25 +00:00
Andrew Ruthven
13083b07e8 Rename username to name in group mappings, drop unused fullname from example
Usinger "username" for the group name is confusing and misleading. Just
use name, but support our users who still have username.

We don't use fullname, drop it from the example.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
bb713137fd memberUid is deprecated, make member default 2024-02-17 02:25:25 +00:00
Andrew Ruthven
a7fc46a848 Add whitespace to sync_LDAP_groups
Make the function more readable.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
820d0992eb Allow running from the root 2024-02-17 02:25:25 +00:00
Andrew Ruthven
995fe296c4 All debug output goes to STDERR so not combined with test results 2024-02-17 02:25:25 +00:00
Andrew Ruthven
86cb62f404 is_head_request is only used once, simplify 2024-02-17 02:25:25 +00:00
Andrew Ruthven
b15c99fe1b Add tests for LDAP sync of users and groups. 2024-02-17 02:25:25 +00:00
Andrew Ruthven
dc2991666a Allow the LDAP group to have no members 2024-02-17 02:25:25 +00:00
Andrew Ruthven
3846d31664 Handle there being no group members in the DB 2024-02-17 02:25:25 +00:00
Andrew Ruthven
1db3663302 We're using a baseDN, not querying a DN 2024-02-17 02:25:25 +00:00
Andrew Ruthven
775ecb8f3b Ensure that users_nothing_done is created as an array
This is likely only going to generate an error on the first time you
sync from LDAP, but still, let's not spit an unncessary error out.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
ed7f308b87 Add default filters for users and groups
Some (all?) LDAP servers will just not respond if there is no filter,
provide a sensible default.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
bacf08fea6 Wrap doc lines at 76 characters. 2024-02-17 02:25:25 +00:00
Andrew Ruthven
702fc05b57 Bail out early to prevent bogus errors if baseDNGroups isn't set 2024-02-17 02:25:25 +00:00
Andrew Ruthven
e73f2d73d4 Better handle when we can't talk to the server, log that 2024-02-17 02:25:25 +00:00
Andrew Ruthven
15e5a89675 Log better information about the connection to the server 2024-02-17 02:25:25 +00:00
Andrew Ruthven
30b05549d0 Remove tests related to memcache, add BPS to copyright
I re-used some of the test LDAP logic from the test suite of Request
Tracker by BPS.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
353a2d1b13 Add testing for LDAP with memcache 2024-02-17 02:25:25 +00:00
Andrew Ruthven
7898efdfda Add the ability to run Perl snippets
This allows for more complicated test suites, which I'll use in the next commit...
2024-02-17 02:25:25 +00:00
Eric Wagner
016e51b4ac use username attr for matching group members 2024-02-17 02:25:25 +00:00
Andrew Ruthven
c75e7aee29 If curl is missing, complain, loudly
As requested on #175,
2024-02-04 01:40:08 +13:00
Andrew Ruthven
0a4471ab06 Wrap most lines in config file to 76 characters
This makes it a lot more readable on an 80 character wide terminal.
2024-02-03 06:24:50 +00:00
Andrew Ruthven
9dc52a5e25 Updates to other tests as side effects of adding room1 and room2 principals 2024-01-21 19:12:42 +13:00
Andrew Ruthven
1ca8284bdc Add ROOM as a principal type
This hopefully resolves #282.
2024-01-21 19:12:42 +13:00
Andrew Ruthven
bc33199083 Run patches when creating the database
From now on we should only provide patches, not a patch and modify
the initial SQL and data. Otherwise we never test the patches.
2024-01-21 17:47:23 +13:00
Andrew Ruthven
27f19cb3b3 Fix typo 2024-01-21 16:41:34 +13:00
Andrew Ruthven
39d0cd5837 Don't change passwords to $pwstars
The password input boxes are supposed to contain the value of $pwstars,
not the string '$pwstars'.
2024-01-21 13:34:30 +13:00
Andrew Ruthven
dabe01657d Bump the AWL version here as well 2024-01-20 15:27:51 +13:00
Andrew Ruthven
216c253ad9 Set a sane timeout for fetching the current DAViCal version
Without this it takes 90 seconds to timeout.
2024-01-20 15:27:51 +13:00
Andrew Ruthven
d42c3dc186 Add PHP version check to setup.php 2024-01-20 15:27:51 +13:00
Andrew Ruthven
3bf44378fa Fix checking if the session is active
The phpversion check was backwards. For PHP >= 5.4.0 we should be
using session_status() === PHP_SESSION_ACTIVE not < 5.4.0.

But in fact, we only support >= 5.4.0, so this check is now redundant.
2024-01-20 02:21:40 +00:00
Andrew Ruthven
ecda4395e8 Update to reflect change in tests 2024-01-19 19:49:02 +13:00
Andrew Ruthven
f137dd788e Update test to straddle the DST change
As pointed out in
https://gitlab.com/davical-project/davical/-/merge_requests/86#note_1209576949
the issue is when events straddle the DST change.
2024-01-19 19:48:03 +13:00
Andrew Ruthven
ff403b84a9 Update ETag, why?! 2024-01-19 19:13:07 +13:00
Chris S
069445579c Fix conversion to UTC for DST changes
The RepeatRuleDateTime constructor extracts the date's time zone then
passes it to the parent class DateTime. Because PHP's DateTime has full
support for time zones, it compensates for them when parsing a string.
Normally this isn't a problem, because the opposite occurs when a
DateTime is converted back into a string; the two adjustments cancel
each other.

Davical often converts a time to UTC by negating the time zone offset
and adding it to the underlying DateTime (keeping the time zone intact).
A problem occurs when the result is on the other side of a daylight-
saving-time transition. In that case the adjustments do not cancel and
an incorrect time string is returned.

This bug is tricky because the problem doesn't manifest during the DST
transition iself, but hours earlier or later depending on the original
time zone. For example, 2022-03-12T18:30:00-08:00 (America/Los_Angeles)
is 2022-03-13T02:30:00Z. Since 2022-03-13 is a 23-hour day in the Los
Angeles time zone (the 2AM-3AM hour is skipped) this becomes
2022-03-13T03:30:00-07:00 after adding the negated offset. FloatOrUTC()
would strip the new offset and simply return "20220313T033000".
2024-01-19 19:13:07 +13:00
Andrew Ruthven
5ef5c756f8 Tests to try and tickle an issue raised in MR 86
However, the result is what it should be? Interesting.

https://gitlab.com/davical-project/davical/-/merge_requests/86
2024-01-19 19:13:07 +13:00
Andrew Ruthven
0ec4fb4dc5 Correct case and plural 2024-01-19 00:43:53 +13:00
Andrew Ruthven
fa1b9ae353 Lower case CN, and use the example domain 2024-01-19 00:43:02 +13:00
Andreas Haerter
11a57a85c6 Another mapping_field key to prevent PHP warnings; typos 2024-01-18 11:05:25 +00:00
Andreas Haerter
d53dad3363 Fix typos in example config; Improve Active Directory example
This fixes a few typos and trailing spaces and improves the AD
example:

- missing port leads to PHP warnings
- use more common and compatible field names for attribute mapping
- distinguishedName as bind user example
2024-01-18 11:05:25 +00:00
Andrew Ruthven
3d2e3d9f12 Move the CSP to only apply to DAViCal htdocs 2023-10-23 18:22:53 +13:00
Andrew Ruthven
aaa70a83f8 Remove sis.redsys.es from CSP
As raised in https://sourceforge.net/p/davical/mailman/message/47766326/
2023-10-23 17:56:54 +13:00
Benedikt Spranger
c88c730236 Gitlab tests: Use postgres 16
Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
2023-10-23 17:47:42 +13:00
Athos Ribeiro
0502860a95 Add support for phpunit 10
In phpunit 10, global states are no longer preserved by default [1].

* https://bugs.debian.org/1039746

[1] https://github.com/sebastianbergmann/phpunit/blob/10.0.0/ChangeLog-10.0.md#changed
2023-07-06 16:28:53 -03:00
eppesuig
de29c6c6ee Better check for $_SERVER['PATH_INFO'] 2023-06-21 23:21:57 +00:00