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