Answer the question
In order to leave comments, you need to log in
How to set accessrule by field in database?
How to set access to actions by a field in a record, for example, a user has $user->role = 1, then give access, if $user->role = 4, then no.
did like this:
'access' => [
'class' => AccessControl::className(),
'ruleConfig' => [
'class' => AccessRule::className(),
],
'rules' => [
[
'allow' => true,
'roles' => [1,4,5],
],
],
],
- does not work
Answer the question
In order to leave comments, you need to log in
RBAC
The roles field is not the user's role attribute, but the rights associated with the user .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question