Hi all,
I am creating a tool for reading, writing and deleting contents.
I have certain permissions (read, write, delete) for each role;
for example, admin is a role that has read,write and delete permissions.
so each user in my tool belongs to a role.
how can yii2 help me to set the permissions when the user logged in so he only can do what he is allowed according to his role.
I am using function behavior to set permissions as bellow:
public function behaviors() {
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
[
'actions' => [
'delete', 'read','write'],
'allow' => true,
'roles' => ['@'],
],
],
],
];
}
but here all logged in users are allowed to these actions, so i need to set the actions according to his role??
can anyone help me ?