mirror of
https://github.com/elyby/accounts.git
synced 2024-11-26 16:52:02 +05:30
Из базы удалена таблица oauth_scopes
This commit is contained in:
parent
744ec9520a
commit
1e94cda399
@ -12,14 +12,12 @@ class ScopeStorage extends AbstractStorage implements ScopeInterface {
|
|||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function get($scope, $grantType = null, $clientId = null) {
|
public function get($scope, $grantType = null, $clientId = null) {
|
||||||
/** @var OauthScope|null $row */
|
if (!in_array($scope, OauthScope::getScopes(), true)) {
|
||||||
$row = OauthScope::findOne($scope);
|
|
||||||
if ($row === null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$entity = new ScopeEntity($this->server);
|
$entity = new ScopeEntity($this->server);
|
||||||
$entity->setId($row->id);
|
$entity->setId($scope);
|
||||||
|
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace common\models;
|
namespace common\models;
|
||||||
|
|
||||||
use yii\db\ActiveRecord;
|
class OauthScope {
|
||||||
|
|
||||||
/**
|
|
||||||
* Поля:
|
|
||||||
* @property string $id
|
|
||||||
*/
|
|
||||||
class OauthScope extends ActiveRecord {
|
|
||||||
|
|
||||||
const OFFLINE_ACCESS = 'offline_access';
|
const OFFLINE_ACCESS = 'offline_access';
|
||||||
const MINECRAFT_SERVER_SESSION = 'minecraft_server_session';
|
const MINECRAFT_SERVER_SESSION = 'minecraft_server_session';
|
||||||
const ACCOUNT_INFO = 'account_info';
|
const ACCOUNT_INFO = 'account_info';
|
||||||
const ACCOUNT_EMAIL = 'account_email';
|
const ACCOUNT_EMAIL = 'account_email';
|
||||||
|
|
||||||
public static function tableName() {
|
public static function getScopes() : array {
|
||||||
return '{{%oauth_scopes}}';
|
return [
|
||||||
|
self::OFFLINE_ACCESS,
|
||||||
|
self::MINECRAFT_SERVER_SESSION,
|
||||||
|
self::ACCOUNT_INFO,
|
||||||
|
self::ACCOUNT_EMAIL,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
25
console/migrations/m161127_145211_remove_oauth_scopes.php
Normal file
25
console/migrations/m161127_145211_remove_oauth_scopes.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use console\db\Migration;
|
||||||
|
|
||||||
|
class m161127_145211_remove_oauth_scopes extends Migration {
|
||||||
|
|
||||||
|
public function safeUp() {
|
||||||
|
$this->dropTable('{{%oauth_scopes}}');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown() {
|
||||||
|
$this->createTable('{{%oauth_scopes}}', [
|
||||||
|
'id' => $this->string(64),
|
||||||
|
$this->primary('id'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->batchInsert('{{%oauth_scopes}}', ['id'], [
|
||||||
|
['offline_access'],
|
||||||
|
['minecraft_server_session'],
|
||||||
|
['account_info'],
|
||||||
|
['account_email'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace tests\codeception\common\fixtures;
|
namespace tests\codeception\common\fixtures;
|
||||||
|
|
||||||
use common\models\OauthScope;
|
|
||||||
use common\models\OauthSession;
|
use common\models\OauthSession;
|
||||||
use yii\test\ActiveFixture;
|
use yii\test\ActiveFixture;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user