Esempio n. 1
0
 /**
  * Revoke a user's app auth on Facebook
  *
  * @param string $providerUserId
  *
  * @throws \DreamFactory\Platform\Exceptions\BadRequestException
  */
 protected function _revokeAuthorization($providerUserId = null)
 {
     $_id = $providerUserId ?: null;
     if (empty($providerUserId) && null === ($_id = $this->getConfig('provider_user_id'))) {
         $_profile = $this->getUserData();
         if (!empty($_profile) && null !== ($_id = $_profile->getUserId())) {
             throw new BadRequestException('Revocation not possible without provider user ID.');
         }
     }
     $_result = $this->fetch('/' . $_id . '/permissions', array(), HttpMethod::Delete);
     if (true !== ($_success = Option::get($_result, 'result', false))) {
         if (HttpResponse::BadRequest !== Option::get($_result, 'code')) {
             Log::error('Facebook revocation for user ID "' . $_id . '" FAILED.');
             return;
         } else {
             Log::debug('Facebook revocation for user ID "' . $_id . '" already completed.');
         }
     } else {
         Log::debug('Facebook revocation for user ID "' . $_id . '" successful.');
     }
     parent::_revokeAuthorization();
 }