Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117786521
D5247.1775252904.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
7 KB
Referenced Files
None
Subscribers
None
D5247.1775252904.diff
View Options
diff --git a/bin/podman_shared b/bin/podman_shared
--- a/bin/podman_shared
+++ b/bin/podman_shared
@@ -171,6 +171,8 @@
-e ROUNDCUBE_BACKEND="http://localhost:8080" \
-e DAV_BACKEND="http://localhost:11080" \
-e DAV_PATH="/dav" \
+ -e FREEBUSY_BACKEND="http://localhost:11080" \
+ -e FREEBUSY_PATH="/freebusy" \
-e COLLABORA_BACKEND="http://localhost:9980" \
-e SIEVE_BACKEND="localhost:4190" \
kolab-proxy:latest $@
@@ -200,6 +202,7 @@
-e FILEAPI_KOLABFILES_BASEURI=http://localhost:8000/api \
-e FILE_API_SERVER_URL=http://localhost:8080/chwala/api/ \
-e KOLAB_ADDRESSBOOK_CARDDAV_SERVER=http://localhost:11080/dav \
+ -e KOLAB_FREEBUSY_SERVER=http://localhost:11080/freebusy/user/%u \
-e CALENDAR_CALDAV_SERVER=http://localhost:11080/dav \
-e TASKLIST_CALDAV_SERVER=http://localhost:11080/dav \
-e PASSPORT_WEBMAIL_SSO_CLIENT_ID \
diff --git a/ci/testctl b/ci/testctl
--- a/ci/testctl
+++ b/ci/testctl
@@ -272,6 +272,7 @@
-e MEET_BACKEND="http://localhost:12080" \
-e ROUNDCUBE_BACKEND="http://localhost:8080" \
-e DAV_BACKEND="http://localhost:11080" \
+ -e FREEBUSY_BACKEND="http://localhost:11080" \
-e COLLABORA_BACKEND="http://localhost:9980" \
-e SIEVE_BACKEND="localhost:4190" \
kolab-proxy:latest /init.sh validate
@@ -286,6 +287,7 @@
-e MEET_BACKEND="http://localhost:12080" \
-e ROUNDCUBE_BACKEND="http://localhost:8080" \
-e DAV_BACKEND="http://localhost:11080" \
+ -e FREEBUSY_BACKEND="http://localhost:11080" \
-e COLLABORA_BACKEND="http://localhost:9980" \
-e SIEVE_BACKEND="localhost:4190" \
-e ELEMENT_BACKEND=http://element:8880 \
diff --git a/docker/proxy/Dockerfile b/docker/proxy/Dockerfile
--- a/docker/proxy/Dockerfile
+++ b/docker/proxy/Dockerfile
@@ -24,6 +24,8 @@
ENV ROUNDCUBE_BACKEND http://roundcube:8080
ENV DAV_BACKEND http://imap:11080
ENV DAV_PATH /dav
+ENV FREEBUSY_BACKEND http://imap:11080
+ENV FREEBUSY_PATH /freebusy
ENV COLLABORA_BACKEND http://collabora:9980
ENV WEBMAIL_PATH /roundcubemail
ENV SIEVE_BACKEND imap:4190
diff --git a/docker/proxy/rootfs/init.sh b/docker/proxy/rootfs/init.sh
--- a/docker/proxy/rootfs/init.sh
+++ b/docker/proxy/rootfs/init.sh
@@ -208,6 +208,13 @@
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
+ location /freebusy {
+ proxy_pass $FREEBUSY_BACKEND$FREEBUSY_PATH;
+ proxy_set_header Host \$host;
+ proxy_set_header X-Real-IP \$remote_addr;
+ proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
+ }
+
# static files
location ^~ /browser {
proxy_pass $COLLABORA_BACKEND;
diff --git a/docker/roundcube/rootfs/opt/app-root/src/roundcubemail-config-templates/libkolab.inc.php b/docker/roundcube/rootfs/opt/app-root/src/roundcubemail-config-templates/libkolab.inc.php
--- a/docker/roundcube/rootfs/opt/app-root/src/roundcubemail-config-templates/libkolab.inc.php
+++ b/docker/roundcube/rootfs/opt/app-root/src/roundcubemail-config-templates/libkolab.inc.php
@@ -1,6 +1,6 @@
<?php
- $config['kolab_freebusy_server'] = '/freebusy';
+ $config['kolab_freebusy_server'] = getenv('KOLAB_FREEBUSY_SERVER') ?: "https://" . ($_SERVER["HTTP_HOST"] ?? '') . "/freebusy/user/%u";
if (file_exists(RCUBE_CONFIG_DIR . '/' . ($_SERVER["HTTP_HOST"] ?? null) . '/' . basename(__FILE__))) {
include_once(RCUBE_CONFIG_DIR . '/' . ($_SERVER["HTTP_HOST"] ?? null) . '/' . basename(__FILE__));
diff --git a/src/config/services.php b/src/config/services.php
--- a/src/config/services.php
+++ b/src/config/services.php
@@ -116,6 +116,10 @@
'uri' => env('ACTIVESYNC_URI', 'https://proxy/Microsoft-Server-ActiveSync'),
],
+ 'freebusy' => [
+ 'uri' => env('FREEBUSY_URI', 'https://proxy/'),
+ ],
+
'smtp' => [
'host' => env('SMTP_HOST', '172.18.0.5'),
'port' => env('SMTP_PORT', 10465),
diff --git a/src/tests/Infrastructure/FreebusyTest.php b/src/tests/Infrastructure/FreebusyTest.php
new file mode 100644
--- /dev/null
+++ b/src/tests/Infrastructure/FreebusyTest.php
@@ -0,0 +1,77 @@
+<?php
+
+namespace Tests\Infrastructure;
+
+use App\DataMigrator\Account;
+use Illuminate\Support\Facades\Http;
+use Tests\BackendsTrait;
+use Tests\TestCase;
+
+class FreebusyTest extends TestCase
+{
+ use BackendsTrait;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+
+ $this->deleteTestUser('fbtest@kolab.org', true);
+ }
+
+ protected function tearDown(): void
+ {
+ $this->deleteTestUser('fbtest@kolab.org', true);
+
+ parent::setUp();
+ }
+
+ /**
+ * Test basic freebusy requests
+ */
+ public function testFreebusyRequest(): void
+ {
+ $user = $this->getTestUser('fbtest@kolab.org', ['password' => 'simple123'], true);
+
+ $baseUri = \config('services.freebusy.uri');
+ $davUri = preg_replace('|^http|', 'dav', \config('services.dav.uri'));
+
+ // First init the account
+ $account = new Account(preg_replace('|://|', '://fbtest%40kolab.org:simple123@', $davUri));
+ $this->initAccount($account);
+
+ // Append an event into the calendar
+ $target_date = \now()->addDays(2)->format('Ymd');
+ $replace = [
+ '/john@kolab.org/' => $user->email,
+ '/20240714/' => $target_date,
+ ];
+ $this->davAppend($account, 'Calendar', ['event/1.ics'], 'event', $replace);
+
+ // Request free-busy - with authentication
+ $response = Http::withOptions(['verify' => false])->baseUrl($baseUri)
+ ->withBasicAuth($user->email, 'simple123')
+ ->get('/user/' . $user->email);
+
+ $body = (string) $response->getBody();
+
+ $this->assertSame($response->getStatusCode(), 200);
+ $this->assertStringContainsString('BEGIN:VFREEBUSY', $body);
+ $this->assertStringContainsString('END:VFREEBUSY', $body);
+ $this->assertStringContainsString("FREEBUSY:{$target_date}T170000Z/{$target_date}T180000Z", $body);
+ $this->assertStringContainsString('DTSTART:' . \now()->format('Ymd'), $body);
+
+ // Request free-busy - unauthenticated, plus use GET parameters
+ $start_date = \now()->subDays(2)->format('c');
+ $response = Http::withOptions(['verify' => false])->baseUrl($baseUri)
+ ->get('/user/' . $user->email, ['period' => 'P10D', 'start' => $start_date]);
+
+ $body = (string) $response->getBody();
+
+ $this->assertSame($response->getStatusCode(), 200);
+ $this->assertStringContainsString('BEGIN:VFREEBUSY', $body);
+ $this->assertStringContainsString('END:VFREEBUSY', $body);
+ $this->assertStringContainsString("FREEBUSY:{$target_date}T170000Z/{$target_date}T180000Z", $body);
+ $this->assertStringContainsString('DTSTART:' . \now()->subDays(2)->format('Ymd'), $body);
+ $this->assertStringContainsString('DTEND:' . \now()->addDays(8)->format('Ymd'), $body);
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 9:48 PM (17 h, 41 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18826798
Default Alt Text
D5247.1775252904.diff (7 KB)
Attached To
Mode
D5247: Enable Cyrus freebusy service
Attached
Detach File
Event Timeline