49 'data_type' =>
'integer',
51 'autocomplete' =>
true,
54 'data_type' =>
'string',
58 'data_type' =>
'string',
61 'data_type' =>
'string',
64 'data_type' =>
'string',
66 'PERSONAL_PHOTO' => array(
67 'data_type' =>
'string',
69 'EXTERNAL_AUTH_ID' => array(
70 'data_type' =>
'string',
74 'data_type' =>
'integer',
78 'data_type' =>
'string',
81 'CAN_DELETE' => array(
82 'data_type' =>
'boolean',
83 'values' => array(self::DISALLOW, self::ALLOW)
85 'PERSONAL_WWW' => array(
86 'data_type' =>
'string',
88 'PERMISSIONS' => array(
89 'data_type' =>
'string',
90 'serizalized' =>
true,
93 'data_type' =>
'\\Bitrix\\Socialservices\\EncryptedToken\\CryptoField',
94 'encryption_complete' => static::cryptoEnabled(
'OATOKEN')
96 'OATOKEN_EXPIRES' => array(
97 'data_type' =>
'integer',
100 'data_type' =>
'\\Bitrix\\Socialservices\\EncryptedToken\\CryptoField',
101 'encryption_complete' => static::cryptoEnabled(
'OASECRET')
103 'REFRESH_TOKEN' => array(
104 'data_type' =>
'\\Bitrix\\Socialservices\\EncryptedToken\\CryptoField',
105 'encryption_complete' => static::cryptoEnabled(
'REFRESH_TOKEN')
107 'SEND_ACTIVITY' => array(
108 'data_type' =>
'boolean',
109 'values' => array(self::DISALLOW, self::ALLOW)
112 'data_type' =>
'string',
114 'INITIALIZED' => array(
115 'data_type' =>
'boolean',
116 'values' => array(self::NOT_INITIALIZED, self::INITIALIZED)
119 'data_type' =>
'Bitrix\Main\UserTable',
120 'reference' => array(
'=this.USER_ID' =>
'ref.ID'),
129 $map = static::getMap();
130 foreach($fields as $key => $value)
132 if(!array_key_exists($key, $map))
134 unset($fields[$key]);
136 elseif($map[$key][
'required'] && empty($fields[$key]))
138 unset($fields[$key]);
142 if(array_key_exists(
'PERSONAL_PHOTO', $fields) && is_array($fields[
'PERSONAL_PHOTO']))
144 $needUpdatePersonalPhoto =
true;
145 $fields[
'PERSONAL_PHOTO'][
'MODULE_ID'] =
'socialservices';
146 $fields[
'PERSONAL_PHOTO'][
'external_id'] = md5_file($fields[
'PERSONAL_PHOTO'][
'tmp_name']);
147 if ($oldValue[
'PERSONAL_PHOTO'])
149 $oldPersonalPhoto = \CFile::GetByID($oldValue[
'PERSONAL_PHOTO'])->Fetch();
150 if ($oldPersonalPhoto[
'EXTERNAL_ID'] == $fields[
'PERSONAL_PHOTO'][
'external_id'])
152 $needUpdatePersonalPhoto =
false;
154 $fields[
'PERSONAL_PHOTO'][
'del'] =
'Y';
155 $fields[
'PERSONAL_PHOTO'][
'old_file'] = $oldValue[
'PERSONAL_PHOTO'];
157 if ($needUpdatePersonalPhoto)
159 $fields[
'PERSONAL_PHOTO'] = \CFile::SaveFile($fields[
'PERSONAL_PHOTO'],
'socialservices');
163 unset($fields[
'PERSONAL_PHOTO']);
181 $ID = $primary[
"ID"];
182 $userInfo = self::$deletedList[$ID];
185 UserLinkTable::deleteBySocserv($userInfo[
"USER_ID"], $userInfo[
"ID"]);
187 if($userInfo[
"EXTERNAL_AUTH_ID"] === \CSocServBitrix24Net::ID)
189 $interface = new \CBitrix24NetOAuthInterface();
190 $interface->setToken($userInfo[
"OATOKEN"]);
191 $interface->setAccessTokenExpires($userInfo[
"OATOKEN_EXPIRES"]);
192 $interface->setRefreshToken($userInfo[
"REFRESH_TOKEN"]);
194 if($interface->checkAccessToken() || $interface->getNewAccessToken())
196 $interface->RevokeAuth();
200 if($userInfo[
"PERSONAL_PHOTO"])
202 \CFile::Delete($userInfo[
"PERSONAL_PHOTO"]);