Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/calendar/lib/core/oauth/ |
Upload File : |
<?php namespace Bitrix\Calendar\Core\Oauth; use Bitrix\Calendar\Sync\Google\Helper; use Bitrix\Main\DI\ServiceLocator; use Bitrix\Main\HttpApplication; class Google extends Base { /** * @throws \Bitrix\Main\LoaderException */ protected function __construct($userId) { if (\CSocServGoogleProxyOAuth::isProxyAuth()) { $this->oauthClient = new \CSocServGoogleProxyOAuth($userId); } else { $this->oauthClient = new \CSocServGoogleOAuth($userId); } $this->oauthClient->getEntityOAuth()->addScope([ 'https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/calendar.readonly' ]); $this->oauthClient->getEntityOAuth()->removeScope('https://www.googleapis.com/auth/drive'); } /** * @return bool */ protected function checkService(): bool { return \CCalendar::isGoogleApiEnabled(); } /** * @return string */ public static function getServiceName(): string { return 'google'; } /** * @return string * @throws \Bitrix\Main\ArgumentNullException * @throws \Bitrix\Main\ArgumentOutOfRangeException * @throws \Bitrix\Main\LoaderException * @throws \Bitrix\Main\ObjectNotFoundException * @throws \Psr\Container\NotFoundExceptionInterface */ public function getUrl(): string { /** @var Helper $helper */ $helper = ServiceLocator::getInstance()->get('calendar.service.google.helper'); $isMobile = HttpApplication::getInstance()->getSession()->get('MOBILE_OAUTH'); $mode = $isMobile ? 'bx_mobile' : 'opener'; $backUrl = $isMobile ? null : '#googleAuthSuccess'; return $this->oauthClient->getUrl( $mode, null, [ 'BACKURL' => $backUrl, 'APIKEY' => $helper->getApiKey() ] ); } }