mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Implemented device code grant
This commit is contained in:
47
common/models/OauthDeviceCode.php
Normal file
47
common/models/OauthDeviceCode.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use yii\behaviors\AttributeTypecastBehavior;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
/**
|
||||
* Fields:
|
||||
* @property string $device_code
|
||||
* @property string $user_code
|
||||
* @property string $client_id
|
||||
* @property array $scopes
|
||||
* @property int|null $account_id
|
||||
* @property bool|null $is_approved
|
||||
* @property int|null $last_polled_at
|
||||
* @property int $expires_at
|
||||
*
|
||||
* Relations:
|
||||
* @property-read OauthClient $client
|
||||
*/
|
||||
final class OauthDeviceCode extends ActiveRecord {
|
||||
|
||||
public static function tableName(): string {
|
||||
return 'oauth_device_codes';
|
||||
}
|
||||
|
||||
public function behaviors(): array {
|
||||
return [
|
||||
[
|
||||
'class' => AttributeTypecastBehavior::class,
|
||||
'attributeTypes' => [
|
||||
'is_approved' => AttributeTypecastBehavior::TYPE_BOOLEAN,
|
||||
],
|
||||
'typecastAfterSave' => true,
|
||||
'typecastAfterFind' => true,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getClient(): OauthClientQuery {
|
||||
/** @noinspection PhpIncompatibleReturnTypeInspection */
|
||||
return $this->hasOne(OauthClient::class, ['id' => 'client_id']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
namespace common\models\amqp;
|
||||
|
||||
use yii\base\BaseObject;
|
||||
|
||||
class AccountBanned extends BaseObject {
|
||||
|
||||
public $accountId;
|
||||
|
||||
public $duration = -1;
|
||||
|
||||
public $message = '';
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
namespace common\models\amqp;
|
||||
|
||||
use yii\base\BaseObject;
|
||||
|
||||
class AccountPardoned extends BaseObject {
|
||||
|
||||
public $accountId;
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
namespace common\models\amqp;
|
||||
|
||||
use yii\base\BaseObject;
|
||||
|
||||
class EmailChanged extends BaseObject {
|
||||
|
||||
public $accountId;
|
||||
|
||||
public $oldEmail;
|
||||
|
||||
public $newEmail;
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
namespace common\models\amqp;
|
||||
|
||||
use yii\base\BaseObject;
|
||||
|
||||
class UsernameChanged extends BaseObject {
|
||||
|
||||
public $accountId;
|
||||
|
||||
public $oldUsername;
|
||||
|
||||
public $newUsername;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user