1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
google.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Core\Oauth;
4
5use Bitrix\Calendar\Sync\Google\Helper;
6use Bitrix\Main\DI\ServiceLocator;
7use Bitrix\Main\HttpApplication;
8
9class Google extends Base
10{
14 protected function __construct($userId)
15 {
16 if (\CSocServGoogleProxyOAuth::isProxyAuth())
17 {
18 $this->oauthClient = new \CSocServGoogleProxyOAuth($userId);
19 }
20 else
21 {
22 $this->oauthClient = new \CSocServGoogleOAuth($userId);
23 }
24
25 $this->oauthClient->getEntityOAuth()->addScope([
26 'https://www.googleapis.com/auth/calendar',
27 'https://www.googleapis.com/auth/calendar.readonly'
28 ]);
29
30 $this->oauthClient->getEntityOAuth()->removeScope('https://www.googleapis.com/auth/drive');
31
32 }
33
37 protected function checkService(): bool
38 {
39 return \CCalendar::isGoogleApiEnabled();
40 }
41
45 public static function getServiceName(): string
46 {
47 return 'google';
48 }
49
58 public function getUrl(): string
59 {
61 $helper = ServiceLocator::getInstance()->get('calendar.service.google.helper');
62 $isMobile = HttpApplication::getInstance()->getSession()->get('MOBILE_OAUTH');
63 $mode = $isMobile ? 'bx_mobile' : 'opener';
64 $backUrl = $isMobile ? null : '#googleAuthSuccess';
65
66 return $this->oauthClient->getUrl(
67 $mode,
68 null,
69 [
70 'BACKURL' => $backUrl,
71 'APIKEY' => $helper->getApiKey()
72 ]
73 );
74 }
75}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getServiceName()
Определения google.php:45
__construct($userId)
Определения google.php:14
if($request->getPost('Update') !==null) elseif( $request->getPost( 'Apply') !==null) elseif($request->getPost('RestoreDefaults') !==null) $backUrl
Определения options.php:66