add backend theme AdminLte, bind reception/transaction to a permission

This commit is contained in:
2015-11-23 19:55:49 +01:00
parent e13866d7da
commit bcae71155e
25 changed files with 993 additions and 128 deletions

View File

@@ -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;
}
}