44
55use App \Entity \Principal ;
66use App \Entity \User ;
7+ use App \Plugins \BirthdayCalendarPlugin ;
78use App \Plugins \DavisIMipPlugin ;
89use App \Plugins \PublicAwareDAVACLPlugin ;
910use App \Services \BasicAuth ;
11+ use App \Services \BirthdayService ;
1012use App \Services \IMAPAuth ;
1113use App \Services \LDAPAuth ;
1214use Doctrine \ORM \EntityManagerInterface ;
@@ -100,6 +102,11 @@ class DAVController extends AbstractController
100102 */
101103 protected $ mailer ;
102104
105+ /**
106+ * @var BirthdayService
107+ */
108+ protected $ birthdayService ;
109+
103110 /**
104111 * Base URI of the server.
105112 *
@@ -142,7 +149,7 @@ class DAVController extends AbstractController
142149 */
143150 protected $ server ;
144151
145- public function __construct (MailerInterface $ mailer , BasicAuth $ basicAuthBackend , IMAPAuth $ IMAPAuthBackend , LDAPAuth $ LDAPAuthBackend , UrlGeneratorInterface $ router , EntityManagerInterface $ entityManager , LoggerInterface $ logger , string $ publicDir , bool $ calDAVEnabled = true , bool $ cardDAVEnabled = true , bool $ webDAVEnabled = false , bool $ publicCalendarsEnabled = true , ?string $ inviteAddress = null , ?string $ authMethod = null , ?string $ authRealm = null , ?string $ webdavPublicDir = null , ?string $ webdavHomesDir = null , ?string $ webdavTmpDir = null )
152+ public function __construct (MailerInterface $ mailer , BasicAuth $ basicAuthBackend , IMAPAuth $ IMAPAuthBackend , LDAPAuth $ LDAPAuthBackend , UrlGeneratorInterface $ router , EntityManagerInterface $ entityManager , LoggerInterface $ logger , BirthdayService $ birthdayService , string $ publicDir , bool $ calDAVEnabled = true , bool $ cardDAVEnabled = true , bool $ webDAVEnabled = false , bool $ publicCalendarsEnabled = true , ?string $ inviteAddress = null , ?string $ authMethod = null , ?string $ authRealm = null , ?string $ webdavPublicDir = null , ?string $ webdavHomesDir = null , ?string $ webdavTmpDir = null )
146153 {
147154 $ this ->publicDir = $ publicDir ;
148155
@@ -159,6 +166,7 @@ public function __construct(MailerInterface $mailer, BasicAuth $basicAuthBackend
159166 $ this ->em = $ entityManager ;
160167 $ this ->logger = $ logger ;
161168 $ this ->mailer = $ mailer ;
169+ $ this ->birthdayService = $ birthdayService ;
162170 $ this ->baseUri = $ router ->generate ('dav ' , ['path ' => '' ]);
163171
164172 $ this ->basicAuthBackend = $ basicAuthBackend ;
@@ -272,6 +280,10 @@ private function initServer(string $authMethod, string $authRealm = User::DEFAUL
272280 $ this ->server ->addPlugin (new \Sabre \CardDAV \VCFExportPlugin ());
273281 }
274282
283+ if ($ this ->cardDAVEnabled && $ this ->calDAVEnabled ) {
284+ $ this ->server ->addPlugin (new BirthdayCalendarPlugin ($ this ->birthdayService ));
285+ }
286+
275287 // WebDAV plugins
276288 if ($ this ->webDAVEnabled && $ this ->webdavTmpDir && $ this ->webdavPublicDir ) {
277289 if (!is_dir ($ this ->webdavTmpDir ) || !is_dir ($ this ->webdavPublicDir )) {
0 commit comments