mirror of
				https://github.com/elyby/accounts.git
				synced 2025-05-31 14:11:46 +05:30 
			
		
		
		
	Все действия, связанные с аккаунтами, теперь вызываются через url `/api/v1/accounts/<id>/<action>`. Добавлена вменяемая система разграничения прав на основе RBAC. Теперь oAuth2 токены генерируются как случайная строка в 40 символов длинной, а не UUID. Исправлен баг с неправильным временем жизни токена в ответе успешного запроса аутентификации. Теперь все unit тесты можно успешно прогнать без наличия интернета.
		
			
				
	
	
		
			37 lines
		
	
	
		
			959 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			959 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
namespace tests\codeception\api\_pages;
 | 
						|
 | 
						|
use yii\codeception\BasePage;
 | 
						|
 | 
						|
/**
 | 
						|
 * @property \tests\codeception\api\FunctionalTester $actor
 | 
						|
 */
 | 
						|
class TwoFactorAuthRoute extends BasePage {
 | 
						|
 | 
						|
    public function credentials(int $accountId) {
 | 
						|
        $this->setRoute($accountId);
 | 
						|
        $this->actor->sendGET($this->getUrl());
 | 
						|
    }
 | 
						|
 | 
						|
    public function enable(int $accountId, $totp = null, $password = null) {
 | 
						|
        $this->setRoute($accountId);
 | 
						|
        $this->actor->sendPOST($this->getUrl(), [
 | 
						|
            'totp' => $totp,
 | 
						|
            'password' => $password,
 | 
						|
        ]);
 | 
						|
    }
 | 
						|
 | 
						|
    public function disable(int $accountId, $totp = null, $password = null) {
 | 
						|
        $this->setRoute($accountId);
 | 
						|
        $this->actor->sendDELETE($this->getUrl(), [
 | 
						|
            'totp' => $totp,
 | 
						|
            'password' => $password,
 | 
						|
        ]);
 | 
						|
    }
 | 
						|
 | 
						|
    private function setRoute(int $accountId) {
 | 
						|
        $this->route = "/v1/accounts/{$accountId}/two-factor-auth";
 | 
						|
    }
 | 
						|
 | 
						|
}
 |