Commit 5056fa96 authored by shajiaiming's avatar shajiaiming

用户权限

parent 3a8db323
......@@ -26,7 +26,7 @@ use yii\web\IdentityInterface;
*/
class Admin extends \common\modelsgii\Admin implements IdentityInterface
{
const STATUS_DELETED = 0;
const STATUS_DELETED = 2;
const STATUS_ACTIVE = 1;
/**
......@@ -34,7 +34,7 @@ class Admin extends \common\modelsgii\Admin implements IdentityInterface
*/
public static function findIdentity($uid)
{
return static::find()->where(['uid' => $uid, 'status' => self::STATUS_ACTIVE])->one();
return static::find()->where(['uid' => $uid])->one();
}
/**
......@@ -45,7 +45,7 @@ class Admin extends \common\modelsgii\Admin implements IdentityInterface
*/
public static function findByUsername($username)
{
return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]);
return static::findOne(['username' => $username]);
}
/**
......
......@@ -23,8 +23,8 @@ use yii\web\IdentityInterface;
*/
class User extends ActiveRecord implements IdentityInterface
{
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
const STATUS_DELETED = 2;
const STATUS_ACTIVE = 1;
const AUTH_SUPER = 'administrator';
......
......@@ -34,6 +34,12 @@ class UserController extends BaseController
$code = -1;
goto doEnd;
}
if (Admin::STATUS_DELETED == $user->status) {
$msg = '用户已停用';
$data = null;
$code = -1;
goto doEnd;
}
$token = [
'iss' => 'https://www.bitfeel.cn', //签发者 可选
'aud' => 'https://www.bitfeel.cn', //接收该JWT的一方,可选
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment