Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
office365.php
1<?php
2
4
8
9class Office365 extends Base
10{
15 protected function __construct($userId)
16 {
18 $helper = ServiceLocator::getInstance()->get('calendar.service.office365.helper');
19
20 $this->oauthClient = new \CSocServOffice365OAuth($userId);
21 $this->oauthClient->getEntityOAuth()->addScope($helper::NEED_SCOPE);
22 }
23
27 protected function checkService(): bool
28 {
29 return \CCalendar::IsCalDAVEnabled() && \CCalendar::isOffice365ApiEnabled();
30 }
31
35 public static function getServiceName(): string
36 {
37 return 'office365';
38 }
39
43 public function getUrl(): string
44 {
45 $isMobile = HttpApplication::getInstance()->getSession()->get('MOBILE_OAUTH');
46 $mode = $isMobile ? 'bx_mobile' : 'opener';
47 $backUrl = $isMobile ? null : '#office365AuthSuccess';
48
49 return $this->oauthClient->getUrl(
50 $mode,
51 null,
52 [
53 'BACKURL' => $backUrl,
54 ]
55 );
56 }
57}