add role checking to controllers
This commit is contained in:
@@ -6,6 +6,7 @@ use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\AccountState;
|
||||
use common\components\RoleDefinition;
|
||||
|
||||
/**
|
||||
* AccountStateSearch represents the model behind the search form about `common\models\AccountState`.
|
||||
@@ -53,6 +54,12 @@ class AccountStateSearch extends AccountState
|
||||
{
|
||||
$query = AccountState::find();
|
||||
|
||||
|
||||
if ( !RoleDefinition::isAdmin() ){
|
||||
$query->innerJoin("user_account_assignment",'account_state.id_account = user_account_assignment.id_account' );
|
||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||
}
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
'sort' => false,
|
||||
|
||||
Reference in New Issue
Block a user