add backend theme AdminLte, bind reception/transaction to a permission
This commit is contained in:
@@ -14,6 +14,8 @@ class LoginForm extends Model
|
||||
public $rememberMe = true;
|
||||
|
||||
private $_user;
|
||||
|
||||
public $roles = null ;
|
||||
|
||||
|
||||
/**
|
||||
@@ -80,7 +82,21 @@ class LoginForm extends Model
|
||||
if ($this->_user === null) {
|
||||
$this->_user = User::findByUsername($this->username);
|
||||
}
|
||||
|
||||
|
||||
if ( $this->_user != null ){
|
||||
if ( $this->roles != null ){
|
||||
$canLogin = false;
|
||||
foreach ($this->roles as $role){
|
||||
$canLogin = $canLogin || Yii::$app->authManager->checkAccess($this->_user->id, $role);
|
||||
}
|
||||
|
||||
if ( !$canLogin ){
|
||||
\Yii::info("user ".$this->_user->username." has no permission to login to administration area!");
|
||||
$this->_user = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_user;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user