コード例 #1
0
 public static function deleteInsertedRow(\appbox $appbox, \API_OAuth2_Application $app)
 {
     $conn = $appbox->get_connection();
     $sql = '
   DELETE FROM api_applications
   WHERE application_id = :id
 ';
     $t = [':id' => $app->get_id()];
     $stmt = $conn->prepare($sql);
     $stmt->execute($t);
     $sql = '
   DELETE FROM api_accounts
   WHERE api_account_id  = :id
 ';
     $acc = self::getAccount();
     $t = [':id' => $acc->get_id()];
     $stmt = $conn->prepare($sql);
     $stmt->execute($t);
 }
コード例 #2
0
 /**
  * @cover \Alchemy\Phrasea\Controller\Root\Developers::authorizeGrantpassword
  */
 public function testAuthorizeGrantpasswordToken()
 {
     $oauthApp = self::$DI['oauth2-app-user'];
     $this->XMLHTTPRequest('POST', '/developers/application/' . $oauthApp->get_id() . '/authorize_grant_password/', ['grant' => '1']);
     $this->assertTrue(self::$DI['client']->getResponse()->isOk());
     $content = json_decode(self::$DI['client']->getResponse()->getContent());
     $this->assertTrue($content->success);
     $oauthApp = new \API_OAuth2_Application(self::$DI['app'], $oauthApp->get_id());
     $this->assertTrue($oauthApp->is_password_granted());
 }
コード例 #3
0
ファイル: Account.php プロジェクト: romainneutron/Phraseanet
 public static function load_with_user(Application $app, API_OAuth2_Application $application, User $user)
 {
     $sql = 'SELECT api_account_id FROM api_accounts
         WHERE usr_id = :usr_id AND application_id = :application_id';
     $params = [":usr_id" => $user->getId(), ":application_id" => $application->get_id()];
     $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
     $stmt->execute($params);
     $row = $stmt->fetch(PDO::FETCH_ASSOC);
     $stmt->closeCursor();
     if (!$row) {
         throw new NotFoundHttpException('Account nof found.');
     }
     return new self($app, $row['api_account_id']);
 }