diff --git a/app/Resources/views/admin/association/membership/_member_menu.html.twig b/app/Resources/views/admin/association/membership/_member_menu.html.twig
index 4ae1b849d..a78e1c0e9 100644
--- a/app/Resources/views/admin/association/membership/_member_menu.html.twig
+++ b/app/Resources/views/admin/association/membership/_member_menu.html.twig
@@ -20,11 +20,6 @@
"lien": path('member_techletter'),
"is_active": current == "techletter",
},
- {
- "nom": "Listes de diffusion",
- "lien": path('my_groups'),
- "is_active": current == "mygroups",
- },
{
"nom": "Assemblée générale",
"lien": path('member_general_meeting'),
diff --git a/app/Resources/views/site/member/index.html.twig b/app/Resources/views/site/member/index.html.twig
index 440d624f1..56bc32adc 100644
--- a/app/Resources/views/site/member/index.html.twig
+++ b/app/Resources/views/site/member/index.html.twig
@@ -105,18 +105,6 @@
-
-
- {% set href = path('my_groups') %}
-
-
-
-
Listes de diffusion
-
-
-
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist
index 1b73ab6b0..0a846c8f6 100644
--- a/app/config/parameters.yml.dist
+++ b/app/config/parameters.yml.dist
@@ -43,8 +43,6 @@ parameters:
meetup_api_consumer_key: ""
meetup_api_consumer_secret: ""
- google_groups_api_key: ""
-
techno_watch_calendar_url: "https://docs.google.com/spreadsheets/d/2cUeAk86Ov7BLYyn0Ad9ge3ecbsdboeQH64wIU9a9Zzp/export?format=csv"
techno_watch_calendar_key: "9Yt0feebMyMrUWx"
diff --git a/app/config/parameters.yml.dist-docker b/app/config/parameters.yml.dist-docker
index 559f9952f..333c70368 100644
--- a/app/config/parameters.yml.dist-docker
+++ b/app/config/parameters.yml.dist-docker
@@ -46,8 +46,6 @@ parameters:
meetup_api_consumer_key: ""
meetup_api_consumer_secret: ""
- google_groups_api_key: ""
-
techno_watch_calendar_url: "https://docs.google.com/spreadsheets/d/2cUeAk86Ov7BLYyn0Ad9ge3ecbsdboeQH64wIU9a9Zzp/export?format=csv"
techno_watch_calendar_key: "9Yt0feebMyMrUWx"
diff --git a/app/config/routing.yml b/app/config/routing.yml
index c5fc7e8e3..39a3c7821 100644
--- a/app/config/routing.yml
+++ b/app/config/routing.yml
@@ -29,10 +29,6 @@ blog:
resource: "routing/blog.yml"
prefix: /blog
-groups:
- resource: "routing/groups.yml"
- prefix: /admin/groups
-
cms_page:
resource: "routing/cms_page.yml"
prefix: /p
diff --git a/app/config/routing/groups.yml b/app/config/routing/groups.yml
deleted file mode 100644
index fa417c73f..000000000
--- a/app/config/routing/groups.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-my_groups:
- path: /
- defaults: {_controller: AppBundle:Groups:myGroups}
diff --git a/app/config/services.yml b/app/config/services.yml
index 8a4776e54..a7f4ed75e 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -451,11 +451,6 @@ services:
factory: ["@ting", get]
arguments: [AppBundle\Event\Model\Repository\TicketSpecialPriceRepository]
- AppBundle\Groups\Model\Repository\MailingListRepository:
- class: AppBundle\Groups\Model\Repository\MailingListRepository
- factory: ["@ting", get]
- arguments: [AppBundle\Groups\Model\Repository\MailingListRepository]
-
AppBundle\Site\Model\Repository\RubriqueRepository:
class: AppBundle\Site\Model\Repository\RubriqueRepository
factory: ["@ting", get]
@@ -597,27 +592,6 @@ services:
AppBundle\Event\JsonLd:
autowire: true
- Google_Client:
- class: Google_Client
- calls:
- - ["setAuthConfig", ["%google_groups_api_key%"]]
- - ["setScopes", [[!php/const Google_Service_Directory::ADMIN_DIRECTORY_GROUP, !php/const Google_Service_Directory::ADMIN_DIRECTORY_GROUP_READONLY]]]
- - ["setSubject", ['admin-mailing-listes-api@afup.org']]
-
- Google_Service_Directory:
- class: Google_Service_Directory
- arguments: ["@Google_Client"]
-
- AppBundle\Groups\GroupRepository:
- autowire: true
-
- AppBundle\Association\Listener\MembersGroupsListener:
- arguments:
- $logger: "@logger"
- autowire: true
- tags:
- - { name: kernel.event_listener, event: member.new, method: onNewMemberEvent }
-
AppBundle\Offices\OfficeFinder:
arguments: ['@Geocoder\Provider\GoogleMaps']
diff --git a/composer.json b/composer.json
index 8c3ae4139..efc2bc8b3 100644
--- a/composer.json
+++ b/composer.json
@@ -27,7 +27,6 @@
"sabre/vobject": "^4.1",
"erusev/parsedown": "^1.6",
"dms/meetup-api-client": "^2.3",
- "google/apiclient": "^2.0",
"robmorgan/phinx": "^0.9.2",
"presta/sitemap-bundle": "^1.5",
"setasign/fpdf": "1.53",
diff --git a/composer.lock b/composer.lock
index dbfb7bab5..476ba1b73 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "474e590136f4222c76bb64ccb6f628b0",
+ "content-hash": "b02a5bda029a7c3d77208e67833d4254",
"packages": [
{
"name": "algolia/algoliasearch-client-php",
@@ -1434,52 +1434,6 @@
],
"time": "2016-10-17T18:31:11+00:00"
},
- {
- "name": "firebase/php-jwt",
- "version": "v5.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/firebase/php-jwt.git",
- "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/firebase/php-jwt/zipball/9984a4d3a32ae7673d6971ea00bae9d0a1abba0e",
- "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "require-dev": {
- "phpunit/phpunit": " 4.8.35"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "Firebase\\JWT\\": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Neuman Vong",
- "email": "neuman+pear@twilio.com",
- "role": "Developer"
- },
- {
- "name": "Anant Narayanan",
- "email": "anant@php.net",
- "role": "Developer"
- }
- ],
- "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
- "homepage": "https://github.com/firebase/php-jwt",
- "time": "2017-06-27T22:17:23+00:00"
- },
{
"name": "friendsofpear/pear_exception",
"version": "0.0.2",
@@ -1538,147 +1492,6 @@
],
"time": "2019-03-25T15:55:08+00:00"
},
- {
- "name": "google/apiclient",
- "version": "v2.2.1",
- "source": {
- "type": "git",
- "url": "https://github.com/googleapis/google-api-php-client.git",
- "reference": "b69b8ac4bf6501793c389d4e013a79d09c85c5f2"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/b69b8ac4bf6501793c389d4e013a79d09c85c5f2",
- "reference": "b69b8ac4bf6501793c389d4e013a79d09c85c5f2",
- "shasum": ""
- },
- "require": {
- "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0",
- "google/apiclient-services": "~0.13",
- "google/auth": "^1.0",
- "guzzlehttp/guzzle": "~5.3.1|~6.0",
- "guzzlehttp/psr7": "^1.2",
- "monolog/monolog": "^1.17",
- "php": ">=5.4",
- "phpseclib/phpseclib": "~0.3.10|~2.0"
- },
- "require-dev": {
- "cache/filesystem-adapter": "^0.3.2",
- "phpunit/phpunit": "~4",
- "squizlabs/php_codesniffer": "~2.3",
- "symfony/css-selector": "~2.1",
- "symfony/dom-crawler": "~2.1"
- },
- "suggest": {
- "cache/filesystem-adapter": "For caching certs and tokens (using Google_Client::setCache)"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Google_": "src/"
- },
- "classmap": [
- "src/Google/Service/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache-2.0"
- ],
- "description": "Client library for Google APIs",
- "homepage": "http://developers.google.com/api-client-library/php",
- "keywords": [
- "google"
- ],
- "time": "2017-11-03T01:19:53+00:00"
- },
- {
- "name": "google/apiclient-services",
- "version": "v0.37",
- "source": {
- "type": "git",
- "url": "https://github.com/googleapis/google-api-php-client-services.git",
- "reference": "75fb5412eec7cfc9f78ac0f8d23e907ce07c2330"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/75fb5412eec7cfc9f78ac0f8d23e907ce07c2330",
- "reference": "75fb5412eec7cfc9f78ac0f8d23e907ce07c2330",
- "shasum": ""
- },
- "require": {
- "php": ">=5.4"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.8"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Google_Service_": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache-2.0"
- ],
- "description": "Client library for Google APIs",
- "homepage": "http://developers.google.com/api-client-library/php",
- "keywords": [
- "google"
- ],
- "time": "2017-12-02T00:23:18+00:00"
- },
- {
- "name": "google/auth",
- "version": "v1.1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/googleapis/google-auth-library-php.git",
- "reference": "548d27d670f0236dc5258fa4cdde6e7b63464cfd"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/548d27d670f0236dc5258fa4cdde6e7b63464cfd",
- "reference": "548d27d670f0236dc5258fa4cdde6e7b63464cfd",
- "shasum": ""
- },
- "require": {
- "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0",
- "guzzlehttp/guzzle": "~5.3.1|~6.0",
- "guzzlehttp/psr7": "~1.2",
- "php": ">=5.4",
- "psr/cache": "^1.0",
- "psr/http-message": "^1.0"
- },
- "require-dev": {
- "friendsofphp/php-cs-fixer": "^1.11",
- "phpunit/phpunit": "3.7.*"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "Google\\Auth\\": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache-2.0"
- ],
- "description": "Google Auth Library for PHP",
- "homepage": "http://github.com/google/google-auth-library-php",
- "keywords": [
- "Authentication",
- "google",
- "oauth2"
- ],
- "time": "2017-10-10T17:01:45+00:00"
- },
{
"name": "google/recaptcha",
"version": "1.2.4",
@@ -3410,98 +3223,6 @@
],
"time": "2015-07-25T16:39:46+00:00"
},
- {
- "name": "phpseclib/phpseclib",
- "version": "2.0.9",
- "source": {
- "type": "git",
- "url": "https://github.com/phpseclib/phpseclib.git",
- "reference": "c9a3fe35e20eb6eeaca716d6a23cde03f52d1558"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c9a3fe35e20eb6eeaca716d6a23cde03f52d1558",
- "reference": "c9a3fe35e20eb6eeaca716d6a23cde03f52d1558",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phing/phing": "~2.7",
- "phpunit/phpunit": "~4.0",
- "sami/sami": "~2.0",
- "squizlabs/php_codesniffer": "~2.0"
- },
- "suggest": {
- "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
- "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
- "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
- "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
- },
- "type": "library",
- "autoload": {
- "files": [
- "phpseclib/bootstrap.php"
- ],
- "psr-4": {
- "phpseclib\\": "phpseclib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jim Wigginton",
- "email": "terrafrost@php.net",
- "role": "Lead Developer"
- },
- {
- "name": "Patrick Monnerat",
- "email": "pm@datasphere.ch",
- "role": "Developer"
- },
- {
- "name": "Andreas Fischer",
- "email": "bantu@phpbb.com",
- "role": "Developer"
- },
- {
- "name": "Hans-Jürgen Petrich",
- "email": "petrich@tronic-media.com",
- "role": "Developer"
- },
- {
- "name": "Graham Campbell",
- "email": "graham@alt-three.com",
- "role": "Developer"
- }
- ],
- "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
- "homepage": "http://phpseclib.sourceforge.net",
- "keywords": [
- "BigInteger",
- "aes",
- "asn.1",
- "asn1",
- "blowfish",
- "crypto",
- "cryptography",
- "encryption",
- "rsa",
- "security",
- "sftp",
- "signature",
- "signing",
- "ssh",
- "twofish",
- "x.509",
- "x509"
- ],
- "time": "2017-11-29T06:38:08+00:00"
- },
{
"name": "pimple/pimple",
"version": "v3.0.2",
@@ -6438,6 +6159,8 @@
"platform": {
"ext-gd": "*",
"ext-json": "*",
+ "ext-dom": "*",
+ "ext-libxml": "*",
"ext-curl": "*"
},
"platform-dev": [],
diff --git a/db/migrations/20231121203300_suppression_mailing_list.php b/db/migrations/20231121203300_suppression_mailing_list.php
new file mode 100644
index 000000000..0f87de9e4
--- /dev/null
+++ b/db/migrations/20231121203300_suppression_mailing_list.php
@@ -0,0 +1,11 @@
+execute('DROP TABLE IF EXISTS afup_mailing_lists');
+ }
+}
diff --git a/doc/groups.md b/doc/groups.md
deleted file mode 100644
index da3be0a7a..000000000
--- a/doc/groups.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# Google Groups
-
-Gestion des mailing-list sur la base de groupes google.
-
-1. Utilisation de l'api google avec le client google/apiclient
-2. Création d'identifiants au format json
-3. [Délégation de droits "domain-wide"](https://developers.google.com/api-client-library/php/auth/service-accounts) pour cette application
-4. Création de l'utilisateur "admin-mailing-listes-api@afup.org" dédié à cet api sur le compte google - il sera "impersonifié" par le client lors des requetes
-5. Attribution à cet utilisateur du role "Administrateur des groupes" (pas d'escalade de droit possible en cas de faille)
-6. Une copie du fichier d'identifiants est dispo dans le gestionnaire de mot de passe partagés, nom "Compte google API Gestion mailing listes"
diff --git a/sources/AppBundle/Association/Listener/MembersGroupsListener.php b/sources/AppBundle/Association/Listener/MembersGroupsListener.php
deleted file mode 100644
index d190c068c..000000000
--- a/sources/AppBundle/Association/Listener/MembersGroupsListener.php
+++ /dev/null
@@ -1,54 +0,0 @@
-mailingListRepository = $mailingListRepository;
- $this->groupRepository = $groupRepository;
- $this->logger = $logger;
- }
-
- public function onNewMemberEvent(NewMemberEvent $event)
- {
- // Premiere cotisation payée: il faut abonner le membre à toutes les ml définies par défaut
- /**
- * @var $lists MailingList[]
- */
- $lists = $this->mailingListRepository->getBy(['autoRegistration' => true]);
-
- foreach ($lists as $list) {
- try {
- $this->groupRepository->addMember($list->getEmail(), $event->getUser()->getEmail());
- } catch (\Google_Service_Exception $e) {
- $this->logger->error(
- 'Could not add a new member to a mailing list',
- ['user' => $event->getUser()->getId(), 'mailing' => $list->getEmail()]
- );
- }
- }
- }
-}
diff --git a/sources/AppBundle/Command/UpdateMailingListMembersCommand.php b/sources/AppBundle/Command/UpdateMailingListMembersCommand.php
deleted file mode 100644
index 6964f35d6..000000000
--- a/sources/AppBundle/Command/UpdateMailingListMembersCommand.php
+++ /dev/null
@@ -1,92 +0,0 @@
-setName('groups:update-members')
- ;
- }
-
- public function execute(InputInterface $input, OutputInterface $output)
- {
- $mailingListRepository = $this->getContainer()->get(\AppBundle\Groups\Model\Repository\MailingListRepository::class);
- $groupsRepository = $this->getContainer()->get(\AppBundle\Groups\GroupRepository::class);
-
- $output->writeln("Synchronisation Mailing Lists " . date('Y-m-d H:i:s'));
-
- $output->writeln(" - récupération des membres à jour de cotisation...");
- /**
- * @var $membersAfup User[]
- */
- $membersAfup = $this->getContainer()->get(\AppBundle\Association\Model\Repository\UserRepository::class)->getActiveMembers(UserRepository::USER_TYPE_ALL);
-
- $emails = [];
- foreach ($membersAfup as $member) {
- $emails[] = $groupsRepository->cleanEmail($member->getEmail());
- }
-
- $filter = function (\Google_Service_Directory_Member $member) use ($emails) {
- // Remove every mail if not a member
- return !in_array($member->getEmail(), $emails);
- };
-
- $this->addMissingMembers($groupsRepository, $emails, $output);
-
- $lists = $mailingListRepository->getAllMailingLists(true);
-
- foreach ($lists as $list) {
- $output->writeln($list->getEmail());
- $membersOfList = $groupsRepository->getMembers($list->getEmail());
- $membersOfListNonMemberAfup = array_filter($membersOfList, $filter);
-
- // Get expired members, which are still member of a mailing list
- foreach ($membersOfListNonMemberAfup as $member) {
- $output->write(sprintf('Removing "%s"', $member->getEmail()));
- if ($groupsRepository->removeMember($list->getEmail(), $member->getEmail()) !== false) {
- $output->writeln('[OK]');
- } else {
- $output->writeln('[NOK]');
- }
- }
- }
- }
-
- private function addMissingMembers(GroupRepository $groupsRepository, $membersAfupEmails, OutputInterface $output)
- {
- $membersOfList = $groupsRepository->getMembers(self::MEMBERS_MAILING_ADDRESS);
-
- $listEmails = [];
- /** @var Google_Service_Directory_Member $memberOfList */
- foreach ($membersOfList as $memberOfList) {
- $listEmails[$memberOfList->getEmail()] = true;
- }
-
- foreach ($membersAfupEmails as $memberEmail) {
- if (!isset($listEmails[$memberEmail])) {
- $output->write(sprintf('Adding "%s"', $memberEmail));
- if ($groupsRepository->addMember(self::MEMBERS_MAILING_ADDRESS, $memberEmail) !== false) {
- $output->writeln('[OK]');
- } else {
- $output->writeln('[NOK]');
- }
- }
- }
- }
-}
diff --git a/sources/AppBundle/Controller/GroupsController.php b/sources/AppBundle/Controller/GroupsController.php
deleted file mode 100644
index 7f0a79b0d..000000000
--- a/sources/AppBundle/Controller/GroupsController.php
+++ /dev/null
@@ -1,88 +0,0 @@
-getMethod() === Request::METHOD_POST) {
- return $this->forward('AppBundle:Groups:registerGroup');
- }
-
- $token = $this->get('security.csrf.token_manager')->getToken('GroupsAction');
-
- /**
- * @var $lists MailingList[]
- */
- $lists = $this->get(\AppBundle\Groups\Model\Repository\MailingListRepository::class)->getAllMailingLists();
- $groupRepository = $this->get(\AppBundle\Groups\GroupRepository::class);
-
- $subscriptions = [];
-
- $error = null;
-
- try {
- foreach ($lists as $list) {
- $subscriptions[$list->getEmail()] = $groupRepository->hasMember($list->getEmail(), $this->getUser()->getEmail());
- }
- } catch (\Exception $exception) { // Can be a guzzle exception or google exception, does not matter actually
- $error = 'Une erreur est survenue en vérifiant les listes auxquelles vous etes abonnés. Les résultats ci-dessous peuvent ne pas refléter vos abonnements.';
- }
-
- return $this->render('admin/groups/lists.html.twig', [
- 'csrf_token' => $token,
- 'lists' => $lists,
- 'error' => $error,
- 'subscriptions' => $subscriptions,
- 'title' => 'Mes listes de diffusion',
- 'page' => 'groups'
- ]);
- }
-
- public function registerGroupAction(Request $request)
- {
- $csrf = $this->get('security.csrf.token_manager')->getToken('GroupsAction');
-
- if ($csrf->getValue() !== $request->get('token')) {
- $this->addFlash('error', 'Jeton anti-csrf invalide.');
- return $this->redirectToRoute('my_groups');
- }
-
- $email = $this->getUser()->getEmail();
- $groupRepository = $this->get(\AppBundle\Groups\GroupRepository::class);
- $mailingListRepository = $this->get(\AppBundle\Groups\Model\Repository\MailingListRepository::class);
- if ($request->request->get('subscribe') !== null) {
- $mailingId = $request->request->getInt('subscribe');
- /**
- * @var $mailing MailingList
- */
- $mailing = $mailingListRepository->get($mailingId);
-
- if ($groupRepository->addMember($mailing->getEmail(), $email)) {
- $this->addFlash('success', sprintf('Vous avez été abonné à la liste "%s"', $mailing->getName()));
- } else {
- $this->addFlash('error', 'Une erreur est survenue lors de la prise en compte de votre abonnement.');
- }
- } elseif ($request->request->get('unsubscribe') !== null) {
- $mailingId = $request->request->getInt('unsubscribe');
- /**
- * @var $mailing MailingList
- */
- $mailing = $mailingListRepository->get($mailingId);
-
- if ($groupRepository->removeMember($mailing->getEmail(), $email)) {
- $this->addFlash('success', sprintf('Vous avez été désabonné de la liste "%s"', $mailing->getName()));
- } else {
- $this->addFlash('error', 'Une erreur est survenue lors de la prise en compte de votre désabonnement.');
- }
- } else {
- $this->addFlash('error', 'Impossible vous abonner à cette liste');
- }
-
- return $this->redirectToRoute('my_groups');
- }
-}
diff --git a/sources/AppBundle/Groups/GroupRepository.php b/sources/AppBundle/Groups/GroupRepository.php
deleted file mode 100644
index 7ddc02e94..000000000
--- a/sources/AppBundle/Groups/GroupRepository.php
+++ /dev/null
@@ -1,76 +0,0 @@
-directory = $directory;
- }
-
- public function hasMember($mailing, $email)
- {
- $email = $this->cleanEmail($email);
- try {
- $this->directory->members->get($mailing, $email);
- } catch (\Google_Service_Exception $exception) {
- return false;
- }
- return true;
- }
-
- public function addMember($mailing, $email)
- {
- $email = $this->cleanEmail($email);
- $member = new \Google_Service_Directory_Member();
- $member->setEmail($email);
- $member->setKind('admin#directory#member');
- $member->setRole('MEMBER');
- try {
- return $this->directory->members->insert($mailing, $member);
- } catch (\Google_Service_Exception $exception) {
- return false;
- }
- }
-
- public function removeMember($mailing, $email)
- {
- $email = $this->cleanEmail($email);
- try {
- return $this->directory->members->delete($mailing, $email);
- } catch (\Google_Service_Exception $exception) {
- return false;
- }
- }
-
- /**
- * @param $mailing
- * @return \Google_Service_Directory_Member[]
- */
- public function getMembers($mailing)
- {
- $members = [];
- $nextPage = [];
- do {
- $list = $this->directory->members->listMembers($mailing, $nextPage);
-
- $nextPage = [];
- if ($list->getNextPageToken() !== null) {
- $nextPage = ['pageToken' => $list->getNextPageToken()];
- }
-
- $members = array_merge($members, $list->getMembers());
- } while ($nextPage !== []);
-
- return $members;
- }
-
- public function cleanEmail($email)
- {
- // Google groups does not supports disposable emails
- return preg_replace('/(.*)\+.*(@.*)/', '$1$2', $email);
- }
-}
diff --git a/sources/AppBundle/Groups/Model/MailingList.php b/sources/AppBundle/Groups/Model/MailingList.php
deleted file mode 100644
index b75ac6b31..000000000
--- a/sources/AppBundle/Groups/Model/MailingList.php
+++ /dev/null
@@ -1,191 +0,0 @@
- 'Toutes les mailing lists de nos antennes',
- 'member' => 'Mailing lists réservées aux membres'
- ];
-
- /**
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
-
- /**
- * @param int $id
- * @return MailingList
- */
- public function setId($id)
- {
- $this->propertyChanged('id', $this->id, $id);
- $this->id = $id;
- return $this;
- }
-
- /**
- * @return string
- */
- public function getEmail()
- {
- return $this->email;
- }
-
- /**
- * @param string $email
- * @return MailingList
- */
- public function setEmail($email)
- {
- $this->propertyChanged('email', $this->email, $email);
- $this->email = $email;
- return $this;
- }
-
- /**
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * @param string $name
- * @return MailingList
- */
- public function setName($name)
- {
- $this->propertyChanged('name', $this->name, $name);
- $this->name = $name;
- return $this;
- }
-
- /**
- * @return string
- */
- public function getDescription()
- {
- return $this->description;
- }
-
- /**
- * @param string $description
- * @return MailingList
- */
- public function setDescription($description)
- {
- $this->propertyChanged('description', $this->description, $description);
- $this->description = $description;
- return $this;
- }
-
- /**
- * @return boolean
- */
- public function getMembersOnly()
- {
- return $this->membersOnly;
- }
-
- /**
- * @param boolean $membersOnly
- * @return MailingList
- */
- public function setMembersOnly($membersOnly)
- {
- $membersOnly = (boolean) $membersOnly;
- $this->propertyChanged('membersOnly', $this->membersOnly, $membersOnly);
- $this->membersOnly = $membersOnly;
- return $this;
- }
-
- /**
- * @return string
- */
- public function getCategory()
- {
- return $this->category;
- }
-
- /**
- * @param string $category
- * @return MailingList
- */
- public function setCategory($category)
- {
- $this->propertyChanged('category', $this->category, $category);
- $this->category = $category;
- return $this;
- }
-
- public function getCategoryLabel()
- {
- return $this->categoryLabels[$this->category];
- }
-
- /**
- * @return bool
- */
- public function getAutoRegistration()
- {
- return $this->autoRegistration;
- }
-
- /**
- * @param bool $autoRegistration
- * @return MailingList
- */
- public function setAutoRegistration($autoRegistration)
- {
- $autoRegistration = (bool) $autoRegistration;
- $this->propertyChanged('autoRegistration', $this->autoRegistration, $autoRegistration);
- $this->autoRegistration = $autoRegistration;
- return $this;
- }
-}
diff --git a/sources/AppBundle/Groups/Model/Repository/MailingListRepository.php b/sources/AppBundle/Groups/Model/Repository/MailingListRepository.php
deleted file mode 100644
index ad6e5499f..000000000
--- a/sources/AppBundle/Groups/Model/Repository/MailingListRepository.php
+++ /dev/null
@@ -1,106 +0,0 @@
-getQueryBuilder(self::QUERY_SELECT);
- $query
- ->cols(['id', 'email', 'name', 'description', 'members_only', 'category'])
- ->from('afup_mailing_lists')
- ->orderBy(['category', 'name'])
- ;
- $params = [];
- if ($membersOnly === true) {
- $query->where('members_only = 1');
- }
- if ($category !== null) {
- $query->where('category = :category');
- $params['category'] = $category;
- }
-
- return $this
- ->getQuery($query->getStatement())
- ->setParams($params)
- ->query($this->getCollection(new HydratorSingleObject()))
- ;
- }
-
- /**
- * @inheritDoc
- */
- public static function initMetadata(SerializerFactoryInterface $serializerFactory, array $options = [])
- {
- $metadata = new Metadata($serializerFactory);
-
- $metadata->setEntity(MailingList::class);
- $metadata->setConnectionName('main');
- $metadata->setDatabase($options['database']);
- $metadata->setTable('afup_mailing_lists');
-
- $metadata
- ->addField([
- 'columnName' => 'id',
- 'fieldName' => 'id',
- 'primary' => true,
- 'autoincrement' => true,
- 'type' => 'int'
- ])
- ->addField([
- 'columnName' => 'email',
- 'fieldName' => 'email',
- 'type' => 'string'
- ])
- ->addField([
- 'columnName' => 'name',
- 'fieldName' => 'name',
- 'type' => 'string'
- ])
- ->addField([
- 'columnName' => 'description',
- 'fieldName' => 'description',
- 'type' => 'string'
- ])
- ->addField([
- 'columnName' => 'members_only',
- 'fieldName' => 'membersOnly',
- 'type' => 'bool',
- 'serializer' => Boolean::class
- ])
- ->addField([
- 'columnName' => 'category',
- 'fieldName' => 'category',
- 'type' => 'string'
- ])
- ->addField([
- 'columnName' => 'auto_registration',
- 'fieldName' => 'autoRegistration',
- 'type' => 'bool',
- 'serializer' => Boolean::class
- ])
- ;
-
- return $metadata;
- }
-}