Answer the question
In order to leave comments, you need to log in
How to destroy a Yii2 controller?
There is one main controller.
There is one top-level role. Let's say employee.
An employee has 2 categories: Field employee and Repair employee.
Each category contains its own types of employees.
for example:
Field worker: -> Field master, Manager.
Repair employee: -> Master, Courier, etc.
The challenge is to run everything in a single main controller. It does not matter what kind of employee, to which category he belongs.
And one more thing, not a little important * .. Each employee (of each category) has his own menu "upper" and "lower". How and where is it best to store them? they are static, but different for everyone.
How can this situation be handled in a smarter way?
Question 2: how would it be more correct to create here in the rbac hierarchy?
Answer the question
In order to leave comments, you need to log in
I never understood why to shove everything into 1 controller ..
well, if you need it .. then check its role and display this or that view ... and this or that data in this view .. the
whole menu is also destroyed (well, in templates and store)
Well, if my memory serves me right RBAC is ala the top have access rights to the bottom .. like there is an employee who can edit the publication ... there is a manager above him who inherits all his rights + can delete the publication. You probably need to build some sort of hierarchy of your own ... I don’t quite understand how your Master can work as a courier))) But maybe I’m wrong here ..
Make a view or layout in general that matches the role, as an option, and just load different views and / or layouts for them.
But you just need to hide the action buttons in the view depending on the role. And set up access to actions by roles.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question