Fixes ACCOUNTS-54A. Include deleted applications in the lookup for exists applications.

This commit is contained in:
ErickSkrauch 2018-11-11 13:48:23 +03:00
parent 9620ff75eb
commit 3646bfcb64
3 changed files with 24 additions and 2 deletions

View File

@ -90,7 +90,10 @@ class OauthClientForm {
}
protected function isClientExists(string $id): bool {
return OauthClient::find()->andWhere(['id' => $id])->exists();
return OauthClient::find()
->includeDeleted()
->andWhere(['id' => $id])
->exists();
}
}

View File

@ -88,4 +88,23 @@ class CreateClientCest {
$I->canSeeResponseJsonMatchesJsonPath('$.data.createdAt');
}
public function testCreateApplicationWithTheSameNameAsDeletedApp(FunctionalTester $I) {
$I->wantTo('create application with the same name as the recently deleted application');
$I->amAuthenticated('admin');
$this->route->createClient('application', [
'name' => 'Deleted OAuth Client',
'description' => '',
'redirectUri' => 'http://some-site.com/oauth/ely',
'websiteUrl' => 'http://some-site.com',
]);
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([
'success' => true,
'data' => [
'clientId' => 'deleted-oauth-client1',
],
]);
}
}

View File

@ -116,7 +116,7 @@ return [
'id' => 'deleted-oauth-client',
'secret' => 'YISLDvIHlLbhsvYoIJScUzTURVXK32Q58sHWSFKyO71iCIlv4YM2Zt1kEK7DQLXX',
'type' => 'application',
'name' => 'I was deleted :(',
'name' => 'Deleted OAuth Client',
'description' => null,
'redirect_uri' => 'http://not-exists-site.com/oauth/ely',
'website_url' => '',