Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
mailru.php
1<?php
2
4
7
9{
10
11 protected function __construct()
12 {
13 $this->oauthEntity = new MailruInterface(
14 \CSocServMailRu2::getOption('mailru2_client_id'),
15 \CSocServMailRu2::getOption('mailru2_client_secret')
16 );
17
18 $this->oauthEntity->addScope(array(
19 'userinfo',
20 'mail.imap',
21 ));
22 }
23
24 protected function check()
25 {
26 $provider = new \CSocServMailRu2;
27
28 return $provider->checkSettings();
29 }
30
31 protected function mapUserData(array $userData)
32 {
33 return array(
34 'email' => $userData['email'],
35 'first_name' => $userData['first_name'],
36 'last_name' => $userData['last_name'],
37 'full_name' => $userData['name'],
38 'image' => $userData['image'],
39 'error' => $userData['error_description'],
40 );
41 }
42
43 public static function getServiceName()
44 {
45 return 'mailru';
46 }
47
48 public function getControllerUrl()
49 {
50 return \CSocServMailRu2::CONTROLLER_URL;
51 }
52
53}
54
55if (Main\Loader::includeModule('socialservices'))
56{
57 class_exists('CSocServMailRu2');
58
59 class MailruInterface extends \CMailRu2Interface
60 {
61
62 public function getStorageTokens()
63 {
64 return false;
65 }
66
67 public function getTokenData()
68 {
69 return array(
70 'access_token' => $this->access_token,
71 'refresh_token' => $this->refresh_token,
72 'expires_in' => $this->accessTokenExpires,
73 );
74 }
75
76 public function getCurrentUser()
77 {
78 $result = parent::getCurrentUser();
79
80 if (is_array($result))
81 {
82 $result = array_merge(
83 $result,
84 $this->getTokenData()
85 );
86 }
87
88 return $result;
89 }
90
91 }
92}
mapUserData(array $userData)
Definition mailru.php:31