Skip to content

Commit 53cd28f

Browse files
committed
Add initial synchronisation with Mailman
This allows syncronisation of mailing list ids from Mailman and they can then be added to a mailing list. At this point there is no actual synchronisation of memberships.
1 parent 70ebb60 commit 53cd28f

28 files changed

+609
-101
lines changed

.env.dist

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ MAIL_TO_SUBSCRIPTION_NAME='Secretary of GEWIS'
5555
5656
MAIL_FROM_SECRETARY_NAME='Secretary of GEWIS'
5757

58+
MAILMAN_API_ENDPOINT=http://mailmanc:8001/3.1/
59+
MAILMAN_API_USERNAME=restadmin
60+
MAILMAN_API_PASSWORD=restpass
61+
5862
# LDAP settings (fill in to enable LDAP)
5963
LDAP_SERVERS=ldaps.gewis.nl
6064
LDAP_STARTTLS=true

.idea/gewisdb.iml

+1-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/php.xml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"require": {
1212
"php": "^8.3.0",
1313
"ext-intl": "*",
14+
"ext-memcached": "^3.2",
1415
"ext-pdo_pgsql": "*",
1516
"ext-pgsql": "*",
1617
"ext-zend-opcache": "*",
@@ -52,7 +53,9 @@
5253
"doctrine/doctrine-laminas-hydrator": "^3.4.0",
5354
"monolog/monolog": "^1.27.1",
5455
"cweagans/composer-patches": "^1.7.3",
55-
"stripe/stripe-php": "^10.21"
56+
"stripe/stripe-php": "^10.21",
57+
"laminas/laminas-cache": "^3.12.1",
58+
"laminas/laminas-cache-storage-adapter-memcached": "^2.5.0"
5659
},
5760
"require-dev": {
5861
"laminas/laminas-component-installer": "^3.4.0",

composer.lock

+72-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/autoload/local.development.php.dist

+9
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ return [
6868
],
6969
],
7070

71+
/**
72+
* Mailman REST API configuration.
73+
*/
74+
'mailman_api' => [
75+
'endpoint' => getenv('MAILMAN_API_ENDPOINT'),
76+
'username' => getenv('MAILMAN_API_USERNAME'),
77+
'password' => getenv('MAILMAN_API_PASSWORD'),
78+
],
79+
7180
/**
7281
* LDAP settings for login to database frontend
7382
*/

config/autoload/local.production.php.dist

+9
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ return [
6868
],
6969
],
7070

71+
/**
72+
* Mailman REST API configuration.
73+
*/
74+
'mailman_api' => [
75+
'endpoint' => getenv('MAILMAN_API_ENDPOINT'),
76+
'username' => getenv('MAILMAN_API_USERNAME'),
77+
'password' => getenv('MAILMAN_API_PASSWORD'),
78+
],
79+
7180
/**
7281
* LDAP settings for login to database frontend
7382
*/

config/modules.config.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
'DoctrineORMModule',
2727
'Laminas\Cache\Storage\Adapter\Filesystem',
2828
'Laminas\Cache\Storage\Adapter\Memory',
29+
'Laminas\Cache\Storage\Adapter\Memcached',
2930
'Application',
3031
'Database',
3132
'Checker',

docker-compose.override.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ services:
3434
mailman-core:
3535
image: maxking/mailman-core:0.4
3636
container_name: mailman-core
37-
hostname: mailman-core
37+
hostname: mailmanc
3838
volumes:
3939
- ./mailman/core:/opt/mailman/
4040
depends_on:
@@ -51,7 +51,7 @@ services:
5151
mailman-web:
5252
image: maxking/mailman-web:0.4
5353
container_name: mailman-web
54-
hostname: mailman-web
54+
hostname: mailmanw
5555
depends_on:
5656
- postgresql
5757
volumes:

docker-compose.yml

+7
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,20 @@ services:
5555
# - STRIPE_CANCEL_URL=
5656
# - STRIPE_SUCCESS_URL=
5757
depends_on:
58+
- memcached
5859
- postfix
5960
volumes:
6061
- gewisdb_data:/code/data:rw
6162
- gewisdb_public:/code/public:rw
6263
networks:
6364
- gewisdb_network
6465
restart: unless-stopped
66+
memcached:
67+
image: memcached:alpine
68+
entrypoint: [ 'memcached', '-m 256' ]
69+
networks:
70+
- gewisdb_network
71+
restart: unless-stopped
6572
postfix:
6673
image: juanluisbaptiste/postfix
6774
env_file:

docker/web/development/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN apk add --no-cache --virtual .build-deps \
1818
$PHPIZE_DEPS \
1919
curl-dev \
2020
icu-dev \
21+
libmemcached-dev \
2122
libpq-dev \
2223
libzip-dev \
2324
linux-headers \
@@ -41,6 +42,8 @@ RUN apk add --no-cache --virtual .build-deps \
4142
pdo_pgsql \
4243
pdo_sqlite \
4344
zip \
45+
&& pecl install memcached \
46+
&& docker-php-ext-enable memcached \
4447
&& pecl install xdebug \
4548
&& docker-php-ext-enable xdebug \
4649
&& rm -r /tmp/pear \

docker/web/production/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ WORKDIR /code
1717
RUN apk add --no-cache --virtual .build-deps \
1818
curl-dev \
1919
icu-dev \
20+
libmemcached-dev \
2021
libpq-dev \
2122
libzip-dev \
2223
openldap-dev \
@@ -34,6 +35,9 @@ RUN apk add --no-cache --virtual .build-deps \
3435
pgsql \
3536
pdo_pgsql \
3637
zip \
38+
&& pecl install memcached \
39+
&& docker-php-ext-enable memcached \
40+
&& rm -r /tmp/pear \
3741
&& runtimeDeps="$( \
3842
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
3943
| tr ',' '\n' \

module/Database/config/module.config.php

+52-7
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,57 @@
581581
],
582582
'may_terminate' => true,
583583
'child_routes' => [
584-
'list-delete' => [
585-
'type' => Segment::class,
584+
'lists' => [
585+
'type' => Literal::class,
586586
'options' => [
587-
'route' => '/list/delete/:name',
588-
'constraints' => [
589-
'name' => '[a-zA-Z0-9_-]+',
590-
],
587+
'route' => '/lists',
591588
'defaults' => [
592-
'action' => 'deleteList',
589+
'action' => 'lists',
590+
],
591+
],
592+
'may_terminate' => true,
593+
'child_routes' => [
594+
'add' => [
595+
'type' => Literal::class,
596+
'options' => [
597+
'route' => '/add',
598+
'defaults' => [
599+
'action' => 'addList',
600+
],
601+
],
602+
],
603+
'edit' => [
604+
'type' => Segment::class,
605+
'options' => [
606+
'route' => '/edit/:name',
607+
'constraints' => [
608+
'name' => '[a-zA-Z0-9_-]+',
609+
],
610+
'defaults' => [
611+
'action' => 'editList',
612+
],
613+
],
614+
],
615+
'delete' => [
616+
'type' => Segment::class,
617+
'options' => [
618+
'route' => '/delete/:name',
619+
'constraints' => [
620+
'name' => '[a-zA-Z0-9_-]+',
621+
],
622+
'defaults' => [
623+
'action' => 'deleteList',
624+
],
625+
],
626+
],
627+
'sync' => [
628+
'type' => Literal::class,
629+
'options' => [
630+
'route' => '/sync',
631+
'defaults' => [
632+
'action' => 'syncLists',
633+
],
634+
],
593635
],
594636
],
595637
],
@@ -705,6 +747,9 @@
705747
'template_path_stack' => [
706748
'database' => __DIR__ . '/../view/',
707749
],
750+
'template_map' => [
751+
'database/settings/edit-list' => __DIR__ . '/../view/database/settings/add-list.phtml',
752+
],
708753
'strategies' => [
709754
'ViewJsonStrategy',
710755
],

0 commit comments

Comments
 (0)