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',
92 'data_type' =>
'\\Bitrix\\Socialservices\\EncryptedToken\\CryptoField',
93 'encryption_complete' => static::cryptoEnabled(
'OATOKEN')
95 'OATOKEN_EXPIRES' => array(
96 'data_type' =>
'integer',
99 'data_type' =>
'\\Bitrix\\Socialservices\\EncryptedToken\\CryptoField',
100 'encryption_complete' => static::cryptoEnabled(
'OASECRET')
102 'REFRESH_TOKEN' => array(
103 'data_type' =>
'\\Bitrix\\Socialservices\\EncryptedToken\\CryptoField',
104 'encryption_complete' => static::cryptoEnabled(
'REFRESH_TOKEN')
106 'SEND_ACTIVITY' => array(
107 'data_type' =>
'boolean',
108 'values' => array(self::DISALLOW, self::ALLOW)
111 'data_type' =>
'string',
113 'INITIALIZED' => array(
114 'data_type' =>
'boolean',
115 'values' => array(self::NOT_INITIALIZED, self::INITIALIZED)
118 'data_type' =>
'Bitrix\Main\UserTable',
119 'reference' => array(
'=this.USER_ID' =>
'ref.ID'),
128 $map = static::getMap();
129 foreach($fields as $key => $value)
131 if(!array_key_exists($key, $map))
133 unset($fields[$key]);
135 elseif(isset($map[$key][
'required']) && $map[$key][
'required'] && empty($fields[$key]))
137 unset($fields[$key]);
141 if(array_key_exists(
'PERSONAL_PHOTO', $fields) && is_array($fields[
'PERSONAL_PHOTO']))
143 $needUpdatePersonalPhoto =
true;
144 $fields[
'PERSONAL_PHOTO'][
'MODULE_ID'] =
'socialservices';
145 $fields[
'PERSONAL_PHOTO'][
'external_id'] = md5_file($fields[
'PERSONAL_PHOTO'][
'tmp_name']);
146 if ($oldValue[
'PERSONAL_PHOTO'])
148 $oldPersonalPhoto = \CFile::GetByID($oldValue[
'PERSONAL_PHOTO'])->Fetch();
149 if ($oldPersonalPhoto[
'EXTERNAL_ID'] == $fields[
'PERSONAL_PHOTO'][
'external_id'])
151 $needUpdatePersonalPhoto =
false;
153 $fields[
'PERSONAL_PHOTO'][
'del'] =
'Y';
154 $fields[
'PERSONAL_PHOTO'][
'old_file'] = $oldValue[
'PERSONAL_PHOTO'];
156 if ($needUpdatePersonalPhoto)
158 $fields[
'PERSONAL_PHOTO'] = \CFile::SaveFile($fields[
'PERSONAL_PHOTO'],
'socialservices');
162 unset($fields[
'PERSONAL_PHOTO']);
180 $ID = $primary[
"ID"];
181 $userInfo = self::$deletedList[$ID];
184 UserLinkTable::deleteBySocserv($userInfo[
"USER_ID"], $userInfo[
"ID"]);
186 if($userInfo[
"EXTERNAL_AUTH_ID"] === \CSocServBitrix24Net::ID)
188 $interface = new \CBitrix24NetOAuthInterface();
189 $interface->setToken($userInfo[
"OATOKEN"]);
190 $interface->setAccessTokenExpires($userInfo[
"OATOKEN_EXPIRES"]);
191 $interface->setRefreshToken($userInfo[
"REFRESH_TOKEN"]);
193 if($interface->checkAccessToken() || $interface->getNewAccessToken())
195 $interface->RevokeAuth();
199 if($userInfo[
"PERSONAL_PHOTO"])
201 \CFile::Delete($userInfo[
"PERSONAL_PHOTO"]);